Reputation: 907
I've been trying to send information from Java to Java script using the JSObject but i keep receiving a java.lang.ClassNotFoundException: com.sun.deploy.appcontext.AppContext exception i'm using netbeans 7.1.
Here is the full stack trace
java.lang.NoClassDefFoundError: com/sun/deploy/appcontext/AppContext
at MapTest.MapApplet.init(MapApplet.java:23)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.sun.deploy.appcontext.AppContext
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 3 more
It is referring to this line of code
win = JSObject.getWindow(this);
These are all my imports
import netscape.javascript.JSObject;
import java.lang.*;
import java.applet.*;
import java.awt.Graphics;
I really need help with this can't seem to find solutions anywhere.
Thanks.
Upvotes: 4
Views: 1545
Reputation: 5834
I came across a similar error and was able to solve it by adding deploy.jar
found in the local Java install to the project build path. Not sure how to do this in netbeans but for others using maven you can try adding the folowing dependency:
<dependency>
<groupId>sun</groupId>
<artifactId>deploy</artifactId>
<version>7.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/deploy.jar</systemPath>
</dependency>
Upvotes: 1