#2165 compilerJava::ClassPath does not respect PathEnv

Caementum Sun 7 Jul 2013

I'm trying to use the PathEnv to keep the fantom home directory and my work directory separate. The issue is that the JDBC jar file I am trying to use will only be resolved if I put it in {fan.home}. I would like to put it in {fan.work}\lib\java\ext\ instead of {fan.home}\lib\java\ext\.

Is this by design or just overlooked?

I've got fantom setup in a Dropbox account using relative paths.

This works: Dropbox\Apps\fantom-1.0.65\lib\java\ext\sqlite-jdbc-3.7.2.jar

This dosn't: Dropbox\workspace\lib\java\ext\sqlite-jdbc-3.7.2.jar

I start fan using

:: Dropbox\Environment\Bin\fan.cmd
@ECHO OFF
SETLOCAL

PUSHD "%~dp0.\..\..\Apps\fantom-1.0.65" || GOTO :EOF
SET fan_home=%CD%
POPD

PUSHD "%~dp0.\..\..\workspace" || GOTO :RUN
SET FAN_ENV=util::PathEnv
SET FAN_ENV_PATH=%CD%
POPD

:RUN
"%~dp0.\..\..\Apps\CommonFiles\Java\bin\java.exe" -cp "%fan_home%\lib\java\sys.jar" fanx.tools.Fan %*
:: End Dropbox\Environment\Bin\fan.cmd

The output of running

fan.cmd compilerJava::ClassPath

is

--- ClassPath ---
Packages Found:
  com.oracle.jrockit.jfr [21]
  com.oracle.jrockit.jfr.client [5]
  com.oracle.jrockit.jfr.management [3]
  com.oracle.net [3]
  com.oracle.nio [2]
  com.oracle.util [1]
  com.sun.java.accessibility [11]
  com.sun.java.accessibility.util [18]
  com.sun.java.accessibility.util.java.awt [5]
  fan.sys [187]
  fanx.emit [30]
  fanx.fcode [43]
  fanx.interop [9]
  fanx.serial [10]
  fanx.test [32]
  fanx.tools [3]
  fanx.util [13]
  java.applet [5]
  java.awt [291]
  java.awt.color [11]
  java.awt.datatransfer [20]
  java.awt.dnd [28]
  java.awt.dnd.peer [3]
  java.awt.event [46]
  java.awt.font [32]
  java.awt.geom [49]
  java.awt.im [4]
  java.awt.im.spi [3]
  java.awt.image [53]
  java.awt.image.renderable [7]
  java.awt.peer [32]
  java.awt.print [12]
  java.beans [139]
  java.beans.beancontext [27]
  java.io [129]
  java.lang [189]
  java.lang.annotation [10]
  java.lang.instrument [5]
  java.lang.invoke [106]
  java.lang.management [40]
  java.lang.ref [17]
  java.lang.reflect [25]
  java.math [10]
  java.net [142]
  java.nio [84]
  java.nio.channels [61]
  java.nio.channels.spi [11]
  java.nio.charset [19]
  java.nio.charset.spi [1]
  java.nio.file [61]
  java.nio.file.attribute [29]
  java.nio.file.spi [3]
  java.rmi [23]
  java.rmi.activation [16]
  java.rmi.dgc [4]
  java.rmi.registry [3]
  java.rmi.server [31]
  java.security [123]
  java.security.acl [8]
  java.security.cert [54]
  java.security.interfaces [13]
  java.security.spec [27]
  java.sql [53]
  java.text [66]
  java.text.spi [6]
  java.util [299]
  java.util.concurrent [161]
  java.util.concurrent.atomic [18]
  java.util.concurrent.locks [23]
  java.util.jar [25]
  java.util.logging [39]
  java.util.prefs [22]
  java.util.regex [116]
  java.util.spi [4]
  java.util.zip [29]
  javax.accessibility [27]
  javax.activation [27]
  javax.activity [3]
  javax.annotation [6]
  javax.annotation.processing [13]
  javax.crypto [46]
  javax.crypto.interfaces [4]
  javax.crypto.spec [16]
  javax.imageio [32]
  javax.imageio.event [5]
  javax.imageio.metadata [16]
  javax.imageio.plugins.bmp [1]
  javax.imageio.plugins.jpeg [4]
  javax.imageio.spi [17]
  javax.imageio.stream [14]
  javax.jws [7]
  javax.jws.soap [7]
  javax.lang.model [2]
  javax.lang.model.element [18]
  javax.lang.model.type [18]
  javax.lang.model.util [23]
  javax.management [94]
  javax.management.loading [10]
  javax.management.modelmbean [18]
  javax.management.monitor [22]
  javax.management.openmbean [26]
  javax.management.relation [27]
  javax.management.remote [20]
  javax.management.remote.rmi [35]
  javax.management.timer [5]
  javax.naming [43]
  javax.naming.directory [21]
  javax.naming.event [7]
  javax.naming.ldap [28]
  javax.naming.spi [16]
  javax.net [4]
  javax.net.ssl [46]
  javax.print [36]
  javax.print.attribute [36]
  javax.print.attribute.standard [77]
  javax.print.event [8]
  javax.rmi [3]
  javax.rmi.CORBA [11]
  javax.rmi.ssl [3]
  javax.script [13]
  javax.security.auth [32]
  javax.security.auth.callback [10]
  javax.security.auth.kerberos [10]
  javax.security.auth.login [27]
  javax.security.auth.spi [1]
  javax.security.auth.x500 [2]
  javax.security.cert [8]
  javax.security.sasl [12]
  javax.smartcardio [16]
  javax.sound.midi [30]
  javax.sound.midi.spi [4]
  javax.sound.sampled [35]
  javax.sound.sampled.spi [4]
  javax.sql [17]
  javax.sql.rowset [16]
  javax.sql.rowset.serial [10]
  javax.sql.rowset.spi [11]
  javax.swing [500]
  javax.swing.border [11]
  javax.swing.colorchooser [24]
  javax.swing.event [50]
  javax.swing.filechooser [11]
  javax.swing.plaf [49]
  javax.swing.plaf.basic [343]
  javax.swing.plaf.metal [169]
  javax.swing.plaf.multi [32]
  javax.swing.plaf.nimbus [125]
  javax.swing.plaf.synth [122]
  javax.swing.table [19]
  javax.swing.text [238]
  javax.swing.text.html [163]
  javax.swing.text.html.parser [14]
  javax.swing.text.rtf [25]
  javax.swing.tree [34]
  javax.swing.undo [9]
  javax.tools [21]
  javax.transaction [3]
  javax.transaction.xa [3]
  javax.xml [1]
  javax.xml.bind [38]
  javax.xml.bind.annotation [40]
  javax.xml.bind.annotation.adapters [7]
  javax.xml.bind.attachment [2]
  javax.xml.bind.helpers [9]
  javax.xml.bind.util [5]
  javax.xml.crypto [17]
  javax.xml.crypto.dom [3]
  javax.xml.crypto.dsig [19]
  javax.xml.crypto.dsig.dom [2]
  javax.xml.crypto.dsig.keyinfo [8]
  javax.xml.crypto.dsig.spec [11]
  javax.xml.datatype [15]
  javax.xml.namespace [3]
  javax.xml.parsers [14]
  javax.xml.soap [29]
  javax.xml.stream [23]
  javax.xml.stream.events [14]
  javax.xml.stream.util [4]
  javax.xml.transform [20]
  javax.xml.transform.dom [3]
  javax.xml.transform.sax [5]
  javax.xml.transform.stax [2]
  javax.xml.transform.stream [2]
  javax.xml.validation [19]
  javax.xml.ws [32]
  javax.xml.ws.handler [7]
  javax.xml.ws.handler.soap [2]
  javax.xml.ws.http [2]
  javax.xml.ws.soap [7]
  javax.xml.ws.spi [5]
  javax.xml.ws.spi.http [3]
  javax.xml.ws.wsaddressing [5]
  javax.xml.xpath [24]
  oracle.jrockit.jfr [44]
  oracle.jrockit.jfr.events [15]
  oracle.jrockit.jfr.openmbean [12]
  oracle.jrockit.jfr.parser [25]
  oracle.jrockit.jfr.settings [12]
  oracle.jrockit.jfr.tools [2]
  org.eclipse.swt [3]
  org.eclipse.swt.accessibility [52]
  org.eclipse.swt.awt [14]
  org.eclipse.swt.browser [185]
  org.eclipse.swt.custom [152]
  org.eclipse.swt.dnd [38]
  org.eclipse.swt.events [56]
  org.eclipse.swt.graphics [32]
  org.eclipse.swt.internal [13]
  org.eclipse.swt.internal.gdip [7]
  org.eclipse.swt.internal.image [69]
  org.eclipse.swt.internal.mozilla [110]
  org.eclipse.swt.internal.mozilla.init [3]
  org.eclipse.swt.internal.ole.win32 [59]
  org.eclipse.swt.internal.opengl.win32 [3]
  org.eclipse.swt.internal.theme [14]
  org.eclipse.swt.internal.webkit [24]
  org.eclipse.swt.internal.win32 [171]
  org.eclipse.swt.layout [9]
  org.eclipse.swt.ole.win32 [30]
  org.eclipse.swt.opengl [3]
  org.eclipse.swt.printing [3]
  org.eclipse.swt.program [1]
  org.eclipse.swt.widgets [67]
  org.ibex.nestedvm [63]
  org.ibex.nestedvm.util [25]
  org.ietf.jgss [8]
  org.jcp.xml.dsig.internal [3]
  org.jcp.xml.dsig.internal.dom [61]
  org.omg.CORBA [193]
  org.omg.CORBA.DynAnyPackage [4]
  org.omg.CORBA.ORBPackage [2]
  org.omg.CORBA.TypeCodePackage [2]
  org.omg.CORBA.portable [20]
  org.omg.CORBA_2_3 [1]
  org.omg.CORBA_2_3.portable [4]
  org.omg.CosNaming [34]
  org.omg.CosNaming.NamingContextExtPackage [6]
  org.omg.CosNaming.NamingContextPackage [18]
  org.omg.Dynamic [1]
  org.omg.DynamicAny [49]
  org.omg.DynamicAny.DynAnyFactoryPackage [2]
  org.omg.DynamicAny.DynAnyPackage [4]
  org.omg.IOP [38]
  org.omg.IOP.CodecFactoryPackage [2]
  org.omg.IOP.CodecPackage [6]
  org.omg.Messaging [2]
  org.omg.PortableInterceptor [57]
  org.omg.PortableInterceptor.ORBInitInfoPackage [5]
  org.omg.PortableServer [54]
  org.omg.PortableServer.CurrentPackage [2]
  org.omg.PortableServer.POAManagerPackage [3]
  org.omg.PortableServer.POAPackage [20]
  org.omg.PortableServer.ServantLocatorPackage [1]
  org.omg.PortableServer.portable [1]
  org.omg.SendingContext [2]
  org.omg.stub.java.rmi [1]
  org.omg.stub.javax.management.remote.rmi [4]
  org.sqlite [35]
  org.w3c.dom [28]
  org.w3c.dom.bootstrap [5]
  org.w3c.dom.css [22]
  org.w3c.dom.events [8]
  org.w3c.dom.html [56]
  org.w3c.dom.ls [11]
  org.w3c.dom.ranges [3]
  org.w3c.dom.stylesheets [5]
  org.w3c.dom.traversal [4]
  org.w3c.dom.views [2]
  org.w3c.dom.xpath [6]
  org.xml.sax [17]
  org.xml.sax.ext [8]
  org.xml.sax.helpers [20]
  sun.security.internal.interfaces [1]
  sun.security.internal.spec [5]
ClassPath Files:
  /S:/Dropbox/Apps/CommonFiles/Java/lib/rt.jar
  /S:/Dropbox/Apps/CommonFiles/Java/lib/jce.jar
  /S:/Dropbox/Apps/CommonFiles/Java/lib/jfr.jar
  /S:/Dropbox/Apps/CommonFiles/Java/lib/ext/access-bridge-32.jar
  /S:/Dropbox/Apps/CommonFiles/Java/lib/ext/access-bridge.jar
  /S:/Dropbox/Apps/CommonFiles/Java/lib/ext/jaccess.jar
  file:/S:/Dropbox/Apps/fantom-1.0.65/lib/java/ext/sqlite-jdbc-3.7.2.jar
  file:/S:/Dropbox/Apps/fantom-1.0.65/lib/java/ext/win32-x86/swt.jar
  /S:/Dropbox/Apps/fantom-1.0.65/lib/java/sys.jar
196ms, 9 files, 274 packages, 8952 classes
-----------------

SlimerDude Sun 7 Jul 2013

I've noticed this myself (as I too use the PATH_ENV) but as my jars are few, I didn't mind sticking them in the fan home dir.

This may be by design, as I guess weaving JavaFFI stuff into a core Fantom class (Env) would prove troublesome. There's no mention of PATH_ENV in docLang::JavaFFI#classpathRuntime and no mention of java classpath in docLang::Env#PathEnv.

andy Mon 8 Jul 2013

Yeah I noticed that too recently - we should fix.

brian Mon 8 Jul 2013

That was probably just because of weird bootstrap issues. But I pushed a fix to add at least the workDir path to the classpath (after the Env instance is initialized). That isn't perfect because it doesn't add all the paths to the classpath (just homeDir and workDir). But I have some plans to basically collapse PathEnv into the core sys::Env so we can simplify a bunch of stuff, and then at that point I will make it work with every path.

Login or Signup to reply.