I have a java program that creates a window, with a ComboBox in it. This ComboBox is populated by an array that I have also created in the program. My program runs fine in NetBeans 7.2.1, but when I try to run it in the Windows command prompt, I get grief about it. The exact error I am getting when I javac WK2.java is:
This is what I get when I try to run it despite these warnings:
This is the program code itself:
As I stated, this code works fine in NetBeans, but will not run in the command prompt, and I cannot understand what is going on.
/>
If someone could help explain to me what stupid mistake I have made here, I would be eternally in their debt!!
/>
Quote
Note: WK2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Recompile with -Xlint:unchecked for details.
This is what I get when I try to run it despite these warnings:
Quote
Exception in thread "main" java.lang.NoClassDefFoundError: WK2<wrong name: WK2/Wk2>
at java.lang.ClassLoader.defineClass1<Native Method>
at java.lang.ClassLoader.defineClass<ClassLoader.java:791>
at java.security.secureClassLoader.defineClass<SecureClassLoader.java:142>
at java.net.URLClassLoader.defineClass<URLClassLoader.java:449>
at java.net.URLClassLoader.access$100<URLClassLoader.java:71>
at java.net.URLClassLoader$1.run<URLClassLoader.java:361>
at java.net.URLClassLoader$1.run<URLClassLoader.java:355>
at java.security.AccessController.doPrivileged<Native Method>
at java.net.URLClassLoader.findClass<URLClassLoader.java:354>
at java.lang.ClassLoader.laodClass<ClassLoader.java:423>
at sun.misc.Launcher$AppClassLoader.loadClass<Layuncher.java:300>
at java.lang.ClassLoader.laodClass<ClassLoader.java:356>
at sun.launcher.LauncherHelper.checkAndLoadMain<LauncherHelper.java:480>
at java.lang.ClassLoader.defineClass1<Native Method>
at java.lang.ClassLoader.defineClass<ClassLoader.java:791>
at java.security.secureClassLoader.defineClass<SecureClassLoader.java:142>
at java.net.URLClassLoader.defineClass<URLClassLoader.java:449>
at java.net.URLClassLoader.access$100<URLClassLoader.java:71>
at java.net.URLClassLoader$1.run<URLClassLoader.java:361>
at java.net.URLClassLoader$1.run<URLClassLoader.java:355>
at java.security.AccessController.doPrivileged<Native Method>
at java.net.URLClassLoader.findClass<URLClassLoader.java:354>
at java.lang.ClassLoader.laodClass<ClassLoader.java:423>
at sun.misc.Launcher$AppClassLoader.loadClass<Layuncher.java:300>
at java.lang.ClassLoader.laodClass<ClassLoader.java:356>
at sun.launcher.LauncherHelper.checkAndLoadMain<LauncherHelper.java:480>
This is the program code itself:
/*Zachariah A Lloyd
* ComboBox/Array*/
package wk2;
import javax.swing.*;
import java.awt.*;
import java.awt.Event.*;
public class WK2 {
String[]stuff = {"Wo
frame();}
public void frame(){
JFrame F = new JFrame("Blizzard Games");
F.setVisible(true);
F.setSize(240,240);
F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel P = new JPanel();
P.add(box);
F.add(P);}
public static void main(String[] args) {
new WK2();}}
As I stated, this code works fine in NetBeans, but will not run in the command prompt, and I cannot understand what is going on.
If someone could help explain to me what stupid mistake I have made here, I would be eternally in their debt!!