Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Sep 2009 13:06:30 +0200
From:      Pieter de Goeje <pieter@degoeje.nl>
To:        freebsd-java@freebsd.org
Cc:        grarpamp <grarpamp@gmail.com>
Subject:   Re: java jar invocation
Message-ID:  <200909211306.31039.pieter@degoeje.nl>
In-Reply-To: <d2e731a10909202352g2b13f2e7q73e5a249022fd129@mail.gmail.com>
References:  <d2e731a10909202352g2b13f2e7q73e5a249022fd129@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909211306.31039.pieter>