First post here. I made a simple calculator program using java and I am trying to put it on my site. From what I collected from previous posts, I have to create a JApplet with all the contents of my program and compress it into a .jar file. Then I need to create a .JNLP file that describes how the applet should be launched.
So, this is where I have problems.
package calculator; import javax.swing.JApplet; import javax.swing.SwingUtilities; public class CalculatorApplet extends JApplet { public void init() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { Calculator calc = new Calculator(); add(calc); } }); } catch(Exception e) { System.err.println("GUI creation failed"); } } }
It seems my applet was not built properly. Whenever I run it, a java.lang.reflect.InvocationTargetException is thrown. Whenever I run my Calculator class regardless of the applet, it works as expected. Any ideas where the source of my error is?
source share