File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes ExceptionInInitializerError (applet) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "ExceptionInInitializerError (applet)" Watch "ExceptionInInitializerError (applet)" New topic
Author

ExceptionInInitializerError (applet)

Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
Hello.. I'm trying to include an applet in a jsp page but i get this exception

in my jsp file i have

the jar file and the webcam folder are in the same folder as the jsp

my first class is GrabberShow:



and Webcam which is the applet:



the applet works only when it's running outside the web application.. what could be wrong?

this is how i get the error: http://i.imgur.com/7lDNv.jpg
and if i press Details it opens this console: http://i.imgur.com/uCr0k.jpg
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

I don't see the images, please re-post them.
Anayway, just guessing... It looks like the Webcam.jar failed to load a native DLL because the applet doesn't have permission to load the native library.


PM Me If You Want to get Urgent Help on Java Programming
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
Nam Ha Minh wrote:I don't see the images, please re-post them.
Anayway, just guessing... It looks like the Webcam.jar failed to load a native DLL because the applet doesn't have permission to load the native library.


thanks for your answer.. I will try to include the libraries in jar and hope it will work

and regarding to imgur, sometimes the DNS server fails to locate the address, so you could try to replace the website with the ip 23.23.110.58
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

It would help if you posted the entire stack-trace from the Java console.

(The most likely guess is that you didn't sign the applet and it's trying to do insecure things, but looking at the stack-trace is better than guessing.)
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
Paul Clapham wrote:It would help if you posted the entire stack-trace from the Java console.

(The most likely guess is that you didn't sign the applet and it's trying to do insecure things, but looking at the stack-trace is better than guessing.)

hello..can you tell me how can i see the java console? i'm using netbeans and glassfish as server, and it doesn't show any errors in glassfish's output; how could i sign the applet and why? since in my policy file i have grant to all permissions?

i used the .bat file to create my jar(from the post above) and it looks like it created well(with the libraries included), but i still get the same ExceptionInInitializerError

Marco Cognolato wrote:Well, an old but good DOS script can do the trick.
Build the java project with Netbeans as usual, then create a directory named 'NewDist' inside NetBeans' project directory and create a file named JarMaker.bat.
Here is the code:



Just double click on it and wait...
At the end of the process a file named YourProjectName.jar will be created inside 'NewDist' directory.

Enjoy.

(P.S.: Remember to include the %JAVA_HOME%/bin in your environment path)


this is the third day in a row i'm trying to make this work -_-
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
i managed to sign the jar file but i still have the error :/
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Andrei, I still couldn't see the images event with your given IP address. So please post a textual exception stack trace here.
If you put the DLL inside jar file, you must write appropriate code to load it. It doesn't work in the same way as the DLL is outside jar file.
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
problem solved

i had to include the libraries in archive like this:
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
now i have another question... how can i add awt components(JPanel/JFrame) inside the applet window(which is displayed in the web application) ? i don't want to be opened another window
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Andrei Prodan wrote:now i have another question... how can i add awt components(JPanel/JFrame) inside the applet window(which is displayed in the web application) ? i don't want to be opened another window

Of course you can create a new JFrame/JPanel from within the applet.
Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
Nam Ha Minh wrote:
Andrei Prodan wrote:now i have another question... how can i add awt components(JPanel/JFrame) inside the applet window(which is displayed in the web application) ? i don't want to be opened another window

Of course you can create a new JFrame/JPanel from within the applet.

and that JFrame will be attached to the jsp page, or it will be displayed in a new window? i want my applet to be displayed right on the page
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Andrei Prodan wrote:and that JFrame will be attached to the jsp page, or it will be displayed in a new window? i want my applet to be displayed right on the page

Andrei, have you read the API for JApplet? There's a one-line code sample in the opening paragraphs that answers your last couple of questions.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ExceptionInInitializerError (applet)