I've written a class for one of my plugins that uses the org.jdom libraries. I have the jdom jar referenced in my classpath, but it does not appear to get loaded when cytoscape starts (I added -verbose to the java call in the shell script) so I'm getting a NoClassDefError exception when my code attempts to use it. Has anyone run across this? Any ideas how I would get around this?
If it's not available on your sdk, put it in the plugin directory. If you still have problems (or new ones), try the extend directroy, either throuch the -Dextend (almost) option in the command line, or putting it in the the specific system directory for extensions. There is a Wiki page about that.
ciao, Andrea
Il giorno 09/gen/06, alle ore 22:19, skillco...@systemsbiology.net ha scritto:
> I've written a class for one of my plugins that uses the org.jdom > libraries. I have the jdom jar referenced in my classpath, but it > does > not appear to get loaded when cytoscape starts (I added -verbose to > the > java call in the shell script) so I'm getting a NoClassDefError > exception when my code attempts to use it. Has anyone run across > this? > Any ideas how I would get around this?
The problem is that the ClassLoader used by Cytoscape to load plugins does not know how to handle referenced or nested jars. The workaround that many of us use in our plugins is to 'unjar' the referenced jar and incorporate its classes into the plugin's jar.
If you are using an ant build script to build your plugin's jar, then you can use the following target description. Note that your jdom.jar file should be placed in the lib directory of your plugin.
<target name="jar" depends="compile" description="Creates PlugIn Jar File.">
<jar destfile="${build.dir}/${plugin.name}.jar"> <fileset dir="${build.classes}"/> </jar> <echo message="${plugin.name}.jar is now complete. It is located in build/ directory"/>
skillco...@systemsbiology.net wrote: > I've written a class for one of my plugins that uses the org.jdom > libraries. I have the jdom jar referenced in my classpath, but it does > not appear to get loaded when cytoscape starts (I added -verbose to the > java call in the shell script) so I'm getting a NoClassDefError > exception when my code attempts to use it. Has anyone run across this? > Any ideas how I would get around this?
you can also specify for Cytoscape to load that jar by loading it as though it were a plugin...
right now cytoscape ignores the classpath (since on many users boxes it is out of date or wrong) so just put what hars you need after the "-p" (for plugin) option.
java -jar cytoscape.jar -p plugins/ -p my.jar
On 1/9/06, allan_kuchin...@agilent.com <allan_kuchin...@agilent.com> wrote:
> The problem is that the ClassLoader used by Cytoscape to load plugins > does not know how to handle referenced or nested jars. The workaround > that many of us use in our plugins is to 'unjar' the referenced jar and > incorporate its classes into the plugin's jar.
> If you are using an ant build script to build your plugin's jar, then > you can use the following target description. Note that your jdom.jar > file should be placed in the lib directory of your plugin.
> <target name="jar" depends="compile" description="Creates PlugIn Jar > File.">
> <jar destfile="${build.dir}/${plugin.name}.jar"> > <fileset dir="${build.classes}"/> > </jar> > <echo message="${plugin.name}.jar is now complete. It is located in > build/ directory"/>
> skillco...@systemsbiology.net wrote: > > I've written a class for one of my plugins that uses the org.jdom > > libraries. I have the jdom jar referenced in my classpath, but it does > > not appear to get loaded when cytoscape starts (I added -verbose to the > > java call in the shell script) so I'm getting a NoClassDefError > > exception when my code attempts to use it. Has anyone run across this? > > Any ideas how I would get around this?
I've just discovered that the jar I want to use is in the the Cytoscape/lib directory (jdom.jar). Does that make a difference for the plugins or do I still need to use these other tricks? If it does make a difference, how do I reference that jar? (I'm sure this is a very basic question but I'm still getting a handle on pathing)
If you are starting Cytoscape the normal way (using the start-up scripts, or the ant file that comes with Cytoscape) cytoscape/lib is already in your classpath. Use jdom the same way you are doing it right now (just add import statements to your java files). -iliana
On 1/31/06, skillco...@systemsbiology.net <skillco...@systemsbiology.net> wrote:
> I've just discovered that the jar I want to use is in the the > Cytoscape/lib directory (jdom.jar). Does that make a difference for > the plugins or do I still need to use these other tricks? If it does > make a difference, how do I reference that jar? (I'm sure this is a > very basic question but I'm still getting a handle on pathing)