@@ -29,6 +29,7 @@ public class File implements Comparable {
2929 private static final boolean isWindows = Directory .isWindows ;
3030 private int bufferSize = 1024 *1024 ; //1MB
3131
32+ //public static final boolean jni = loadDLL();
3233
3334 //**************************************************************************
3435 //** Constructor
@@ -1554,7 +1555,7 @@ protected static synchronized boolean loadDLL(){
15541555
15551556 if (dllLoaded ==null ){ //haven't tried to load the dll yet...
15561557 String jvmPlatform = System .getProperty ("os.arch" );
1557- String dllName = null ;
1558+ String dllName ;
15581559 if (jvmPlatform .equalsIgnoreCase ("x86" )){
15591560 dllName = "javaxt-core.dll" ;
15601561 }
@@ -1574,7 +1575,7 @@ else if(jvmPlatform.equalsIgnoreCase("amd64")){
15741575
15751576
15761577 //Construct list of possible file locations for the dll
1577- java .util .ArrayList <java .io .File > files = new java .util .ArrayList <java . io . File >();
1578+ java .util .ArrayList <java .io .File > files = new java .util .ArrayList <>();
15781579 files .add (new java .io .File (jar .getFile ().getParentFile (), dllName ));
15791580 javaxt .io .Directory dir = new javaxt .io .Directory (System .getProperty ("user.home" ));
15801581 for (String appDir : new String []{"AppData\\ Local" , "Application Data" }){
@@ -1625,8 +1626,14 @@ else if(jvmPlatform.equalsIgnoreCase("amd64")){
16251626 dllLoaded = true ;
16261627 break ;
16271628 }
1628- catch (Exception e ){
1629- e .printStackTrace ();
1629+ catch (Throwable t ){
1630+ String msg = "already loaded in another classloader" ;
1631+ if (t .getMessage ().contains (msg )){ //UnsatisfiedLinkError
1632+ System .err .println (System .mapLibraryName ("javaxt_core" ) + " " + msg );
1633+ }
1634+ else {
1635+ t .printStackTrace ();
1636+ }
16301637 }
16311638 }
16321639 }
@@ -1635,10 +1642,10 @@ else if(jvmPlatform.equalsIgnoreCase("amd64")){
16351642 //Don't update the static variable to give users a chance to fix
16361643 //the load error (e.g. manually extract the dll and copy it into
16371644 //one of the directories).
1638- //dllLoaded = false;
1645+ //dllLoaded = false;
16391646 }
16401647
1641- return dllLoaded ;
1648+ return dllLoaded == null ? false : dllLoaded ;
16421649 }
16431650 else {//not windows...
16441651 return false ;
0 commit comments