开发者

ClassNotFoundException problem outside Eclipse

I'm having problems running my application outside Eclipse, because when I try this runtime exception is thrown:

Exception in thread "Thread-5" java.lang.NoClassDefFoundErr开发者_如何学Pythonor: javazoom/jl/player/Player
    at InterruptHandler$1.execute(InterruptHandler.java:22)
    at InterruptHandler.run(InterruptHandler.java:47)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: javazoom.jl.player.Player
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 3 more

As you can probably conclude from the exception, I'm using JLayer, which I use to play some MP3 files. Of course my first conclusion was the classpath. However, I've now tried numerous different classpath options, however this exact exception has been thrown on my every attempt. Note that all of the .class files reside in a 'bin' directory in the default package, and amongst all of those .class files my .jar file is as well. Here's what classpath options I've tried (by the way, I'm on OS X):

java -classpath /Users/b-dahse/Documents/workspace/project/bin Game
java -classpath /Users/b-dahse/Documents/workspace/project/bin/jl.jar
java -classpath jl.jar Game
java -classpath *.jar Game


I think you want:

java -classpath /Users/b-dahse/Documents/workspace/project/bin/jl.jar:/Users/b-dahse/Documents/workspace/project/bin Game

...to pick up your .jar file as well as any of the miscellaneous .class files you have in the bin directory.

EDIT: Updated classpath to use : separator per comment from @Angel O'Sphere, as OP is using a Mac.


Open Tomcat launch configuration and add jl1 jar in classpath . Restart your server and the problem resolved for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜