• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ExceptionInInitializerError (applet)

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Andrei Prodan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i managed to sign the jar file but i still have the error :/
 
Nam Ha Minh
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem solved

i had to include the libraries in archive like this:
 
Andrei Prodan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
I'm still in control here. LOOK at this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic