java jar invocation
Pieter de Goeje
pieter at degoeje.nl
Mon Sep 21 11:18:37 UTC 2009
On Monday 21 September 2009 08:52:37 grarpamp wrote:
> Hi. Figured it was time to try out java on unix.
> Am I completely missing something about java or should these jars be
> firing off like applications with this invocation?
> Maybe I need a simpler app to test with?
>
>
> RELENG_8 i386 built 20090901 [installworld from RELENG_7]
>
> # pkg_add
> diablo-jre-1.6.0.07.02
> javavmwrapper-2.3.3
> xextproto-7.0.5
> xproto-7.0.15
> xtrans-1.2.3
>
> java -jar ./Azureus4.2.0.8.jar
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/cli/ParseException
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.cli.ParseException
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>
> java -jar ./freenet7-freenet-build01232.jar
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sleepycat/je/DatabaseException
> Caused by: java.lang.ClassNotFoundException: com.sleepycat.je.DatabaseException
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
The errors are pretty self explanatory: it can't find the class org.apache.commons.cli.ParseException and com.sleepycat.he.DatabaseException. These classes are included in 3rd party libraries which you will have to add to the classpath for this to work. Once you have downloaded these libraries you can add them to the classpath like this:
java -cp /path/to/lib1.jar:/path/to/lib2.jar -jar program.jar
BTW, Azureus (Vuze) is also in ports. Also you might want to install java/jdk16 instead of diablo-jre16, because in my experience it works better, especially considering you are now running a jre compiled for FreeBSD-7.0.
- Pieter
More information about the freebsd-java
mailing list