• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in "thread-2" of splash screen

 
Eamon Williams
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created a JAR file from which my application entry point is "SplashScreen". The program compiles and runs in Netbeans. But when I run the JAR file, I get the following error:

Exception in thread "Thread-2" java.lang.NoClassDefFoundError: SplashScreen $1
at SplashScreen.run(SplashScreen.java:28)
at java.lang.Thread.run(Thread.java:595)


line 28 of SplashScreen.java starts with:

[CODE]
public void run(){
JWindow splash = showSplashScreen();
try{
Thread.sleep(5000);

java.awt.EventQueue.invokeLater(new Runnable() { // **** LINE 28
public void run() {
JFrame jFrame1 = new JFrame();
jFrame1.setSize(700,500);
new TestGUI(jFrame1).setVisible(true);

}

});
}
catch(InterruptedException ie){
System.err.println("interrupt: " + ie.getMessage());
}
splash.dispose();
[CODE]

The splash screen does load, but it doesn't dipose and load the application frame (which is TestGUI in the above code). I'm new at this, is this some type of awt exception that i'm not addressing? Are there errors that Netbeans will let you get away with, because my program works fine from there?

Thanks for the help
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file SplashScreen$1.class isn't getting put into your JAR file, for one reason or another. It contains the definition of that anonymous Runnable that starts at line 28. Reexamine how you're creating that JAR file, and make sure all the class files are getting into it.
 
Eamon Williams
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. I didn't realise that the other class instances were actually the subclasses so I was only adding the first class file to the jar.

The program works on my PC (netbeans installed), but what are the requirements for other PCs to be able to run a java application from a jar? I'm not sure of the details.

Many thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!