src/Java.st
branchjk_new_structure
changeset 889 e20f62a18b13
parent 883 b0eecab8d572
child 906 fea23aa2b228
--- a/src/Java.st	Mon Aug 08 09:14:18 2011 +0000
+++ b/src/Java.st	Mon Aug 08 14:16:47 2011 +0000
@@ -272,18 +272,18 @@
 
 addToClassPathInRuntime:aPath
 
-    | path file url |
+    | path file url clc scl |
     "Java might not be loaded/or initialized, in this case
      there is no no need to inform java about new entry in classpath"
-    (Java at:#'java.lang.System') isNil ifTrue:[^self].
+
+    JavaVM booted ifFalse:[^self].
+    (clc := Java at: 'java.lang.ClassLoader') isNil ifTrue:[^self].
+    (scl := clc instVarNamed: #scl) isNil ifTrue:[^self].	
 
     path := Java as_String: aPath asString.        
     file := (Java at:'java.io.File') new perform: #'<init>(Ljava/lang/String;)V' with: path; yourself.
     url := file perform: #'toURL()Ljava/net/URL;'.
-            
-    ((Java at:#'java.lang.ClassLoader') 
-        perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;')
-        perform: #'addURL(Ljava/net/URL;)V' with: url.
+    scl perform: #'addURL(Ljava/net/URL;)V' with: url.
 
     "Created: / 01-08-1997 / 21:10:07 / cg"
     "Modified: / 17-09-1998 / 20:43:55 / cg"