J
Jane Sfelc
I'm new to Java programming and need some help ...
I'm using NetBeans 4.0 beta2 to program Java applications. I can
compile and run them without trouble inside the IDE, but I can't get
them to work outside the IDE. I am using Swing components on my forms.
After building the application, the IDE generates PrimerForm.class,
PrimerForm$1.class, PrimerForm$2.class, PrimerForm$3.class and
PrimeraApp.jar files (just one class in my first project).
I am trying to run the application outside the IDE. When I type:
java PrimerForm
The results are:
Exception in thread "main" java.lang.NoClassDefFoundError: PrimerForm
(wrong nam
e: primeraapp/PrimerForm)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
When I type:
java -jar PrimeraApp.jar
The results are:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/netbe
ans/lib/awtextra/AbsoluteLayout
at primeraapp.PrimerForm.initComponents(PrimerForm.java:30)
at primeraapp.PrimerForm.<init>(PrimerForm.java:17)
at primeraapp.PrimerForm$3.run(PrimerForm.java:71)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
I think may be I should use the -classpath option when running the
program from command prompt, but have no idea on what path to use.
May be there is a very simple way to get my application to work
outside the IDE, could anyone please tell me how?
Your help would be greatly appreciated.
- Jane
I'm using NetBeans 4.0 beta2 to program Java applications. I can
compile and run them without trouble inside the IDE, but I can't get
them to work outside the IDE. I am using Swing components on my forms.
After building the application, the IDE generates PrimerForm.class,
PrimerForm$1.class, PrimerForm$2.class, PrimerForm$3.class and
PrimeraApp.jar files (just one class in my first project).
I am trying to run the application outside the IDE. When I type:
java PrimerForm
The results are:
Exception in thread "main" java.lang.NoClassDefFoundError: PrimerForm
(wrong nam
e: primeraapp/PrimerForm)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
When I type:
java -jar PrimeraApp.jar
The results are:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/netbe
ans/lib/awtextra/AbsoluteLayout
at primeraapp.PrimerForm.initComponents(PrimerForm.java:30)
at primeraapp.PrimerForm.<init>(PrimerForm.java:17)
at primeraapp.PrimerForm$3.run(PrimerForm.java:71)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
I think may be I should use the -classpath option when running the
program from command prompt, but have no idea on what path to use.
May be there is a very simple way to get my application to work
outside the IDE, could anyone please tell me how?
Your help would be greatly appreciated.
- Jane