java applet stops running on exceptions
- by Marius
I've developed a simple applet that imports an image from the clipboard. When i run the class file from NetBeans, everything works fine. But when i try to run it as an applet ... it gives me lots of errors in the java console and does not run ...
- The applet is signed
- There is a static method in one class, called getImageFromClipboard(). When the applet runs, it calls this method.
- getImageFromClipboard() method has a try-catch block and suppresses all errors. It simply returns either a BufferedImage or null.
- When applet runs, it does some visual adjustments before calling getImageFromClipboard()
Now the scenario is as follows: the class from netbeans runs, fails to import the image and adjusts the interface accordingly (displays an error in a label)
But when i run it in a browser, java console is filled with errors and nothing after the getImageFromClipboard() line works. Although the applet itself loads and does everything it's supposed do do before importing the image.
So why am i getting errors if i accept the certificate and all of the possible errors are in try-catch blocks? None of this code should throw any exceptions.
Any ideas why this is happening? Or do you need to see the errors to tell?
UPDATE
I've managed to find out the problem myself. The class that i'm using is not in the jar file :( How do i add it in? I'm using "add jar folder" in netbeans on the libraries package to import it but it does not seem to get copied to the jar.