src/Java.st
branchjk_new_structure
changeset 912 e651488f5741
parent 908 d990d0d520d9
child 920 e6e8a96b217c
equal deleted inserted replaced
911:efa922d67283 912:e651488f5741
   270     "Created: / 20-12-2010 / 17:26:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   270     "Created: / 20-12-2010 / 17:26:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   271 !
   271 !
   272 
   272 
   273 addToClassPathInRuntime:aPath
   273 addToClassPathInRuntime:aPath
   274 
   274 
   275     | path file url clc scl |
   275     | path file url scl |
   276     "Java might not be loaded/or initialized, in this case
   276     "Java might not be loaded/or initialized, in this case
   277      there is no no need to inform java about new entry in classpath"
   277      there is no no need to inform java about new entry in classpath"
   278 
   278 
   279     JavaVM booted ifFalse:[^self].
   279     JavaVM booted ifFalse:[^self].
   280     (clc := Java at: 'java.lang.ClassLoader') isNil ifTrue:[^self].
   280     scl := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl.
   281     (scl := clc instVarNamed: #scl) isNil ifTrue:[^self].	
   281     scl ifNil:[
   282 
   282         scl := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'.
       
   283     ].
   283     path := Java as_String: aPath asString.        
   284     path := Java as_String: aPath asString.        
   284     file := (Java at:'java.io.File') new perform: #'<init>(Ljava/lang/String;)V' with: path; yourself.
   285     file := (Java at:'java.io.File') new perform: #'<init>(Ljava/lang/String;)V' with: path; yourself.
   285     url := file perform: #'toURL()Ljava/net/URL;'.
   286     url := file perform: #'toURL()Ljava/net/URL;'.
   286     scl perform: #'addURL(Ljava/net/URL;)V' with: url.
   287     scl perform: #'addURL(Ljava/net/URL;)V' with: url.
   287 
   288