user489041
user489041

Reputation: 28304

Java ClassNotFound Exception

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?

Upvotes: 0

Views: 1186

Answers (2)

Isaac Truett
Isaac Truett

Reputation: 8884

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.

Upvotes: 2

Richard H
Richard H

Reputation: 39055

As the stack trace states, the class com.sun.media.JMFSecurityManager is not found. It's presumably missing from your classpath, so check this.

Upvotes: 1

Related Questions