« Return to Thread: [scala] problem with getResource
Scalads and Lasses,
Please see the trace below. The method getResource on java.lang.Thread.currentThread().getContextClassLoader() is not behaving as i expect it would. It never returns anything but null as far as my experimentation has gone. Any help would be greatly appreciated.
Best wishes,
--greg
[INFO] [scala:console]
Welcome to Scala version 2.7.1.final (Java HotSpot(TM) Client VM, Java 1.5.0_13).
Type in expressions to have them evaluated.
Type :help for more information.
scala> new java.io.File("WorkspaceDecls")
new java.io.File("WorkspaceDecls")
new java.io.File("WorkspaceDecls")
res0: java.io.File = WorkspaceDecls
scala> res0.listFiles()
res0.listFiles()
res0.listFiles()
res1: Array[java.io.File] = Array(WorkspaceDecls/App.class, WorkspaceDecls/gemcutter.default.cws)
scala> java.lang.Thread.currentThread().getContextClassLoader()
java.lang.Thread.currentThread().getContextClassLoader()
java.lang.Thread.currentThread().getContextClassLoader()
res2: java.lang.ClassLoader = java.net.URLClassLoader@697c4
scala> res2.getResource("WorkspaceDecls/gemcutter.default.cws")
res2.getResource("WorkspaceDecls/gemcutter.default.cws")
res2.getResource("WorkspaceDecls/gemcutter.default.cws")
res3: java.net.URL = null
scala> new java.io.File(".").getCanonicalPath()
new java.io.File(".").getCanonicalPath()
new java.io.File(".").getCanonicalPath()
res4: java.lang.String = /Users/lgm/work/src/projex/bobj/magritte/pipe-cutter/pipes_to_cal
scala> res2.getResource(new java.io.File(".").getCanonicalPath() + "WorkspaceDecls/gemcutter.default.cws")
res2.getResource(new java.io.File(".").getCanonicalPath() + "WorkspaceDecls/gemcutter.default.cws")
res2.getResource(new java.io.File(".").getCanonicalPath() + "WorkspaceDecls/gemcutter.default.cws")
res5: java.net.URL = null
scala>
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105
+1 206.650.3740
http://biosimilarity.blogspot.com
« Return to Thread: [scala] problem with getResource
| Free Forum Powered by Nabble | Forum Help |