|
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) _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
Did you set your class path correctly?
Do your jar files require any additional libraries? 在2009年09月21日的14:52,grarpamp写道: > 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) > _______________________________________________ > [hidden email] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "[hidden email]" _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by grarpamp
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 _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
> BTW, Azureus (Vuze) is also in ports. Also you might want to
> install java/jdk16 instead of diablo-jre16 I figure it's better for me to learn the hard way before trying ports. The goal is openoffice. Yeah, hard :) So I found the commons here and pulled the jar file out of it: http://apache.mirrors.redwire.net/commons/cli/binaries/commons-cli-1.2-bin.zip commons-cli-1.2.jar Then ran this simple thing again: java -cp `pwd`/commons-cli-1.2.jar -jar `pwd`/Azureus4.2.0.8.jar And I got the same error. But the access time on commons-cli-1.2.jar wasn't bumped, so I ktrace'd it. 5987 java NAMI "/.../commons-cli.jar" Playing along and dropping the apparently unneeded -cp arg, I get: ln -s commons-cli-1.2.jar commons-cli.jar java -jar `pwd`/Azureus4.2.0.8.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout So after downloading and symlinking log4j, this simplification works: java -jar Azureus4.2.0.8.jar --ui console The closest I can get so far to having the libs in one dir without symlinks and calling the app from elsewhere is to hunt up Main-Class in [Thanks AR]: unzip Azureus4.2.0.8.jar META-INF/MANIFEST.MF then run: java -cp `pwd`/jarz/\*:`pwd`/Azureus4.2.0.8.jar org.gudy.azureus2.ui.common.Main --ui console or move azureus into jarz and run: java -cp `pwd`/jarz/\* org.gudy.azureus2.ui.common.Main --ui console or: java -cp jarz/\*:Azureus4.2.0.8.jar org.gudy.azureus2.ui.common.Main --ui console The -jar style of that does not work: java -cp jarz/\*:Azureus4.2.0.8.jar -jar Azureus4.2.0.8.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException I was eventually hoping for something like: java -cp /usr/local/jarz -jar /usr/local/bin/app.jar > you are now running a jre compiled for FreeBSD-7.0 Yes. Hopefully we'll have a current java from the foundation for 8.0 when it comes out. And to keep current I want to figure out how to build from Sun's java sources sometime. If that doesn't work, I'll try ports. _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
On Mon, 21 Sep 2009 23:09:19 +0200, grarpamp <[hidden email]> wrote:
>> BTW, Azureus (Vuze) is also in ports. Also you might want to >> install java/jdk16 instead of diablo-jre16 > > I figure it's better for me to learn the hard way before trying > ports. The goal is openoffice. Yeah, hard :) > > So I found the commons here and pulled the jar file out of it: > http://apache.mirrors.redwire.net/commons/cli/binaries/commons-cli-1.2-bin.zip > commons-cli-1.2.jar > > Then ran this simple thing again: > java -cp `pwd`/commons-cli-1.2.jar -jar `pwd`/Azureus4.2.0.8.jar > > And I got the same error. But the access time on commons-cli-1.2.jar > wasn't bumped, so I ktrace'd it. > 5987 java NAMI "/.../commons-cli.jar" > > Playing along and dropping the apparently unneeded -cp arg, I get: > ln -s commons-cli-1.2.jar commons-cli.jar > java -jar `pwd`/Azureus4.2.0.8.jar > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/log4j/Layout > > So after downloading and symlinking log4j, this simplification works: > java -jar Azureus4.2.0.8.jar --ui console > > > The closest I can get so far to having the libs in one dir without > symlinks and calling the app from elsewhere is to hunt up Main-Class > in [Thanks AR]: > unzip Azureus4.2.0.8.jar META-INF/MANIFEST.MF > then run: > java -cp `pwd`/jarz/\*:`pwd`/Azureus4.2.0.8.jar > org.gudy.azureus2.ui.common.Main --ui console > or move azureus into jarz and run: > java -cp `pwd`/jarz/\* > org.gudy.azureus2.ui.common.Main --ui console > or: > java -cp jarz/\*:Azureus4.2.0.8.jar > org.gudy.azureus2.ui.common.Main --ui console > > > The -jar style of that does not work: > java -cp jarz/\*:Azureus4.2.0.8.jar -jar Azureus4.2.0.8.jar > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/cli/ParseException > > I was eventually hoping for something like: > java -cp /usr/local/jarz -jar /usr/local/bin/app.jar > > >> you are now running a jre compiled for FreeBSD-7.0 > > Yes. Hopefully we'll have a current java from the foundation for > 8.0 when it comes out. And to keep current I want to figure out > how to build from Sun's java sources sometime. If that doesn't > work, I'll try ports. You have to add all jars to the classpath explicitly. You can't specify a directory with jars or use *. This is the easiest way I know. for i in /usr/local/jarz/*.jar; do CLASSPATH="$CLASSPATH:$i" done java -cp "$CLASSPATH" -jar foo.jar Ronald. _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
-cp and -jar are mutually exclusive.
On Mon, Sep 21, 2009 at 2:53 PM, Ronald Klop <[hidden email]> wrote: > On Mon, 21 Sep 2009 23:09:19 +0200, grarpamp <[hidden email]> wrote: > >>> BTW, Azureus (Vuze) is also in ports. Also you might want to >>> install java/jdk16 instead of diablo-jre16 >> >> I figure it's better for me to learn the hard way before trying >> ports. The goal is openoffice. Yeah, hard :) >> >> So I found the commons here and pulled the jar file out of it: >> >> http://apache.mirrors.redwire.net/commons/cli/binaries/commons-cli-1.2-bin.zip >> commons-cli-1.2.jar >> >> Then ran this simple thing again: >> java -cp `pwd`/commons-cli-1.2.jar -jar `pwd`/Azureus4.2.0.8.jar >> >> And I got the same error. But the access time on commons-cli-1.2.jar >> wasn't bumped, so I ktrace'd it. >> 5987 java NAMI "/.../commons-cli.jar" >> >> Playing along and dropping the apparently unneeded -cp arg, I get: >> ln -s commons-cli-1.2.jar commons-cli.jar >> java -jar `pwd`/Azureus4.2.0.8.jar >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/log4j/Layout >> >> So after downloading and symlinking log4j, this simplification works: >> java -jar Azureus4.2.0.8.jar --ui console >> >> >> The closest I can get so far to having the libs in one dir without >> symlinks and calling the app from elsewhere is to hunt up Main-Class >> in [Thanks AR]: >> unzip Azureus4.2.0.8.jar META-INF/MANIFEST.MF >> then run: >> java -cp `pwd`/jarz/\*:`pwd`/Azureus4.2.0.8.jar >> org.gudy.azureus2.ui.common.Main --ui console >> or move azureus into jarz and run: >> java -cp `pwd`/jarz/\* >> org.gudy.azureus2.ui.common.Main --ui console >> or: >> java -cp jarz/\*:Azureus4.2.0.8.jar >> org.gudy.azureus2.ui.common.Main --ui console >> >> >> The -jar style of that does not work: >> java -cp jarz/\*:Azureus4.2.0.8.jar -jar Azureus4.2.0.8.jar >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/commons/cli/ParseException >> >> I was eventually hoping for something like: >> java -cp /usr/local/jarz -jar /usr/local/bin/app.jar >> >> >>> you are now running a jre compiled for FreeBSD-7.0 >> >> Yes. Hopefully we'll have a current java from the foundation for >> 8.0 when it comes out. And to keep current I want to figure out >> how to build from Sun's java sources sometime. If that doesn't >> work, I'll try ports. > > You have to add all jars to the classpath explicitly. You can't specify a > directory with jars or use *. > This is the easiest way I know. > > for i in /usr/local/jarz/*.jar; do > CLASSPATH="$CLASSPATH:$i" > done > java -cp "$CLASSPATH" -jar foo.jar > > Ronald. > _______________________________________________ > [hidden email] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "[hidden email]" > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Ronald Klop-2
Ronald Klop, 21.09.09, 23:53h CEST:
> You have to add all jars to the classpath explicitly. You can't specify a > directory with jars or use *. > This is the easiest way I know. > > for i in /usr/local/jarz/*.jar; do > CLASSPATH="$CLASSPATH:$i" > done > java -cp "$CLASSPATH" -jar foo.jar Actually, I recently found out that you can use wildcards, but only since 1.6. See [1], section "Understanding class path wildcards". Best regards, Stefan [1]: http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "[hidden email]" |
| Powered by Nabble | Edit this page |
