What kind of problem? Exception in thread "main" java.lang.NoClassDefFoundError: \ java \ jframedemo / class

Category: Java SE
 
winter_luck
2013-08-20 05:06:27

Sponsored Links
What kind of problem? Has passed javac, but with the java.exe This error occurs when compiling:
Exception in thread "main" java.lang.NoClassDefFoundError: \ java \ jframedemo / class

procedure is very simple, is based on the book written by:
import javax.swing. *;
public class JFrameDemo {
public static void main (String ; args []) {
JFrame frame = new JFrame ("FrameDemo");
frame.setSize (400,200);
frame.setVisible (true);
}
}
my JDK is 1.4.1

Sponsored Links

woaizikao
2013-08-20 05:21:02
is not set class path problems
should be set: set classpath =.; C: \ j2sdk \ lib \ dt.jar; C: \ j2sdk \ lib \ tools.jar;
join autoexec.bat on it, you can also set once under MS-DOS on the line
joyingkin
2013-08-20 05:34:52
I'm on my computer in the environment variable has been set, and later again in the DOS consists of, is the same way.
jyuntao
2013-08-20 05:42:28
compile time is not written?
I JFrameDemo.java copied into the directory of the jdk,
first sentence is: javac JFrameDemo.java
second sentence is: java JFrameDemo.class
in Then went wrong. I think this is not a grammatical sentence. .
lu12391
2013-08-20 06:02:00
compiled
first sentence is: javac JFrameDemo.java
second sentence is: java JFrameDemo / / without extension
yipp000
2013-08-20 06:11:40
Result become so:
D: \ j2sdk \ j2sdk1.4.2> java jframedemo
Exception in thread "main" java.lang.NoClassDefFoundError: jframedemo (wrong nam
e: JFrameDemo)
at java.lang.ClassLoader.defineClass0 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java: 537)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java: 12
3)
at java.net . URLClassLoader.defineClass (URLClassLoader.java: 251)
at java.net.URLClassLoader.access $ 100 (URLClassLoader.java: 55)
at java.net.URLClassLoader $ 1.run (URLClassLoader.java: 194)
; at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader . java: 187)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 289)
; at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java: 274)
at ; java.lang.ClassLoader.loadClass (ClassLoader.java: 235)
at java.lang.ClassLoader.loadClassInternal (ClassLoader.java: 302 )
zhongguotaian
2013-08-20 06:24:41
I am a novice here, so unknown. . . Trouble you help. . . Thank you. .
zxw1234
2013-08-20 06:27:13
you use java-classpath. jframedemo try, I think this can. . .
ThinkMeter
2013-08-20 06:45:41
javac JFrameDemo.java

java JFrameDemo.class
lumeng08
2013-08-20 07:05:14
>> lry1983 (rylie):
>> You use java-classpath. jframedemo try, I think this can. . .

Results:
D: \ j2sdk \ j2sdk1.4.2> java-classpath. jframedemo
Exception in thread "main" java . lang.NoClassDefFoundError: jframedemo (wrong nam
e: JFrameDemo)
at java.lang.ClassLoader . defineClass0 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java: 537)
; at java.security.SecureClassLoader.defineClass (SecureClassLoader.java: 12
3)
at java.net.URLClassLoader.defineClass (URLClassLoader.java: 251)
at java.net.URLClassLoader.access $ 100 (URLClassLoader.java: 55)
at java.net.URLClassLoader $ 1.run (URLClassLoader.java: 194)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader.java: 187)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 289)
at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java: 274)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 235)
at java.lang. ClassLoader.loadClassInternal (ClassLoader.java: 302)

cibiren2009
2013-08-20 07:12:51
I encountered this problem:

1. filenames sensitive issues
2 look CLASSPATH variable is not set, try to delete
3.path setup problems
cescraul
2013-08-20 07:27:37


is the same. . . Hey. . . . .
with import javax.swing. * means including letter in lib \ dt.jar file documents in the swing all the classes?

Who can help me solve this problem? ? Heroes. . . . Help yourselves. . . I just started to learn, do not want a big mistake by section ah.
xxws0602
2013-08-20 07:44:50
path problem may be, if the path is no problem, you use the following compilation:
javac JFrameDemo.java

java JFrameDemo.class

JCreator can be used to write java original program, very good, in Huajun downloading

q_dan
2013-08-20 07:48:02
your class is "JFrameDemo.java", uppercase, When you compile should be uppercase;
However, you use the lowercase - java-classpath. jframedemo
java is case sensitive!
xunfenglong__
2013-08-20 07:58:34
>> lry1983 (rylie):
>> you use java-classpath. jframedemo try, I think this can. . .

Results:
D: \ j2sdk \ j2sdk1.4.2> java-classpath. jframedemo
Exception in thread "main" java . lang.NoClassDefFoundError: jframedemo (wrong nam
e: JFrameDemo)
at java.lang.ClassLoader . defineClass0 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java: 537)
; at java.security.SecureClassLoader.defineClass (SecureClassLoader.java: 12
3)
at java.net.URLClassLoader.defineClass (URLClassLoader.java: 251)
at java.net.URLClassLoader.access $ 100 (URLClassLoader.java: 55)
at java.net.URLClassLoader $ 1.run (URLClassLoader.java: 194)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader.java: 187)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 289)
at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java: 274)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 235)
at java.lang. ClassLoader.loadClassInternal (ClassLoader.java: 302)

sorry! ! JAVA case-sensitive. CLASS file name should be the same name as your class! ! You try

java-classpath. JFrameDemo

Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.