I've obviously a newbie to java, *ATTEMPTING* to teach myself, but I've run into a problem that's really held me up.
As you can see below, I'm attempting to run a java application called "helloworldapp". helloworldapp.class (and .java) is located in c:\j2sdk1.4.2_06\bin\hello
worldapp.
It compiles just fine but will not run. I think there may be a classpath problem, but I've changed the path a ton of times and can't get it right.
__________________________
_______
C:\j2sdk1.4.2_06\bin\Hello
WorldApp>j
avac helloworldapp.java
C:\j2sdk1.4.2_06\bin\Hello
WorldApp>j
ava helloworldapp
Exception in thread "main" java.lang.NoClassDefFoundE
rror: helloworldapp (wrong
name: HelloWorldApp)
at java.lang.ClassLoader.defi
neClass0(N
ative Method)
at java.lang.ClassLoader.defi
neClass(Un
known Source)
at java.security.SecureClassL
oader.defi
neClass(Un
known Source)
at java.net.URLClassLoader.de
fineClass(
Unknown Source)
at java.net.URLClassLoader.ac
cess$100(U
nknown Source)
at java.net.URLClassLoader$1.
run(Unknow
n Source)
at java.security.AccessContro
ller.doPri
vileged(Na
tive Method)
at java.net.URLClassLoader.fi
ndClass(Un
known Source)
at java.lang.ClassLoader.load
Class(Unkn
own Source)
at sun.misc.Launcher$AppClass
Loader.loa
dClass(Unk
nown Source)
at java.lang.ClassLoader.load
Class(Unkn
own Source)
at java.lang.ClassLoader.load
ClassInter
nal(Unknow
n Source)
C:\j2sdk1.4.2_06\bin\Hello
WorldApp>d
ir
Volume in drive C has no label.
Volume Serial Number is 549D-DF6C
Directory of C:\j2sdk1.4.2_06\bin\Hello
WorldApp
10/22/2004 03:46 PM <DIR> .
10/22/2004 03:46 PM <DIR> ..
10/22/2004 04:17 PM 432 HelloWorldApp.class
10/22/2004 03:59 PM 157 HelloWorldApp.java
2 File(s) 589 bytes
2 Dir(s) 3,418,599,424 bytes free
__________________________
__________
_
Running WinXP SP2, and here's what I have for my environmental variables:
User variables:
CLASSPATH - .;C:\j2sdk1.4.2_06\bin
PATH - .;C:\j2sdk1.4.2_06\bin
System variables:
CLASSPATH - .;C:\j2sdk1.4.2_06\lib\too
ls.jar;C:\
j2sdk1.4.2
_06\jre\li
b\rt.jar;C
:\j2sdk1.4
.2_06\jre\
classes
JAVA_HOME - c:\j2sdk1.4.2_06
Path - %SystemRoot%\system32;%Sys
temRoot%;%
SystemRoot
%\System32
\Wbem;C:\P
rogram Files\NMapWin\\bin;"C:\Pro
gram Files\Symantec\Norton Ghost 2003\";C:\j2sdk1.4.2_06\bi
n;JAVA_HOM
E;
I found many instances of this issue here and elsewhere and have tried most of their suggestions, and now I'm afraid I may have just completely messed it all up!
Please help!
Start Free Trial