My application tries to execute the following line of code
JMFSecurity jmfSecurity = JMFSecurityManager.getJMFSecurity();
That line throws the following exception. Here is a stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/media/JMFSecurityManager
at com.compunetix.vsd.stix.main.JMFUtilities.Registry.(Registry.java:71)
at com.compunetix.vsd.stix.main.JMFUtilities.JMFRunner.getJMFPropertiesFileLocation(JMFRunner.java:129)
at com.compunetix.vsd.stix.main.Main.setUpJMF(Main.java:274)
at com.compunetix.vsd.stix.main.Main.main(Main.java:166)
Caused by: java.lang.ClassNotFoundException: com.sun.media.JMFSecurityManager
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 4 more
Any ideas why this might be throwing an exception. This used to work fine. I didn't make any changes to this file. Any ideas?
ClassNotFoundException means the class isn't on your classpath.
You're using a class from the com.sun package. Those classes are implementation details, not public APIs. You might have switched to a version of the JVM that implements things differently. Generally, depending on com.sun classes is a bad idea.
As the stack trace states, the class com.sun.media.JMFSecurityManager is not found. It's presumably missing from your classpath, so check this.
Related
I created a Java project in Eclipse and created a simple class with a main method.
Problem: when I run the program(without any server etc), I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
at autoPEC.main(autoPEC.java:6)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 1 more
What I tried to solve the problem: included path to commons-codec.jar in the environment variables JAVA_HOME by putting a semicolon after the jdk path
Result: class still does not run
I think that the problem could be that I am not correctly including the classpath. How should I do this?
Google the missing jar and include it in the Java Build path
Reason for this exception is missing of a jar.
please add the jar(Commons-codec.jar) file needed for this org.apache.commons.codec.DecoderException
Download it from here
http://commons.apache.org/proper/commons-codec/download_codec.cgi
then put it in your classpath
I'm pretty new to Java, and thought that using 3D graphics would be interesting. I found Ardor 3D and installed it, etc. I followed the steps from here.
But when I ran the example code, such as ExampleRunner.java, it gives me this error:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/ardor3d/example/ExampleRunner
Caused by: java.lang.ClassNotFoundException: com.ardor3d.example.ExampleRunner 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)
I've looked everywhere for solutions to this error, but I can't find anyone else who has it.
At first, ensure that your Eclipse install supports Maven, you should install M2Eclipse if necessary.
Then, you use an obsolete and unmaintained version of Ardor3D, Renanse stopped maintaining it more than a year ago:
http://blog.renanse.com/2014/03/winding-down.html
You should switch to JogAmp's Ardor3D Continuation which is actively maintained by the JogAmp community. I'm responsible for engine support. You can find more information about it here:
http://jogamp.org/wiki/index.php/Ardor3D_Overview
http://jogamp.org/wiki/index.php/Ardor3D_Tutorial
I wrote some Java code that takes several arguments using Eclipse. I was able to compile and execute the code just fine by entering the arguments in the "Run configurations."
However, I need to be able to run my code via command-line. This is what I tried:
javac -g ./MyCode.java
java MyCode ./fileOne.txt ./fileTwo.txt ./fileThree.txt
And the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: mypackage/MyCode
Caused by: java.lang.ClassNotFoundException: mypackage.MyCode
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)
I don't understand what is going on. My code does not have any bugs when I run through Eclipse. Help?
You are not setting up the classpath properly.
http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
A java applet that I wrote works exactly as intended when I run it from the code in the applet viewer on my computer. However, when I uploaded it to my website, I get a series of errors. I looked up the errors but can't find any useful information to help figure out the problem. Here are the errors.
java.lang.NoClassDefFoundError: Main
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:678)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: Main
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 13 more
Exception: java.lang.NoClassDefFoundError: Main
I understand that this might not be descriptive enough without a sample of my code but can anyone discern anything from these errors? Thanks
It simply means the class Main referenced in your code is not included in the applet.
Most likely you did not included the class when exporting to jar.
It'd be great if you included your code, but the problem is likely that you're referencing a class called Main, yet none exists in the CLASSPATH of the service dumping this exception.
You likely need to either create (or rename!) the source to "Main.java" and build a Main.class and put it in the correct path or alter the path to reference where Main.class (or the archive containing Main.class) is stored.
I am using Ubuntu 11.04, when i start RubyMine3.1 it gave this error.
Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/util/lang/UrlClassLoader
at com.intellij.idea.Main.main(Main.java:55)
Caused by: java.lang.ClassNotFoundException: com.intellij.util.lang.UrlClassLoader
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more
I tried every thing, i also have sun-java installed, set it default by update-java-alternatives, also my JAVA_HOME, JDK_HOME, RUBYMINE_JDK points to the sun-java directory, but still no success.
Does any one have any idea about it?
Damaged download or some classes left from older version? Try to download again and unpack into an empty directory.
Did you install any third-party plug-ins? In this case you should try to delete them from the plugins directory.
The class which fails to load is located in RubyMine/lib/util.jar. Maybe you are using an old version of rubymine.sh which doesn't add util.jar to the classpath?