 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
jay1000 Guest
|
Posted: Fri Jan 02, 2004 12:24 am Post subject: Newbie Squared - Can't Run At All |
|
|
I decided to learn Java so I borrowed SAMS Teach Yourself Java 2 from the
library and downloaded j2sdk-1_4_02_03-windows-i586-p.exe from Sun. It
seemed to install OK (in Windows XP Home).
Changed the PATH to:
PATH
%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:Program
FilesCommon FilesAdaptec SharedSystem;C:Program FilesCommon FilesUlead
SystemsMPEG;C:Program FilesSupport Tools;C:j2sdk1.4.2_03bin
Then I used javac to compile a couple of the SAMS source codes. They
compiled without any error messages. But, when I tried to run them using
java I got the error message for the first SAMS program ellsworth:
Exception in thread "main" java.lang.NoClassDefFoundError: ellsworth
Then I changed the CLASSPATH to:
CLASSPATH "iQTJava.zip";c:j2sdk1.4.2_03lib
It didn't do any good. Similar error message with ellsworth and a couple of
other SAMS programs. It's obviously looking for something and not finding
it.
I can't seem to even get off the ground with Java. Any suggestions?
|
|
| Back to top |
|
 |
KC Wong Guest
|
Posted: Fri Jan 02, 2004 1:57 am Post subject: Re: Newbie Squared - Can't Run At All |
|
|
| Quote: | I decided to learn Java so I borrowed SAMS Teach Yourself Java 2 from the
library and downloaded j2sdk-1_4_02_03-windows-i586-p.exe from Sun. It
seemed to install OK (in Windows XP Home).
Changed the PATH to:
PATH
%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:Program
FilesCommon FilesAdaptec SharedSystem;C:Program FilesCommon
FilesUlead
SystemsMPEG;C:Program FilesSupport Tools;C:j2sdk1.4.2_03bin
Then I used javac to compile a couple of the SAMS source codes. They
compiled without any error messages. But, when I tried to run them using
java I got the error message for the first SAMS program ellsworth:
Exception in thread "main" java.lang.NoClassDefFoundError: ellsworth
Then I changed the CLASSPATH to:
CLASSPATH "iQTJava.zip";c:j2sdk1.4.2_03lib
It didn't do any good. Similar error message with ellsworth and a couple
of
other SAMS programs. It's obviously looking for something and not finding
it.
I can't seem to even get off the ground with Java. Any suggestions?
|
The error message means Java VM cannot find your class "ellsworth". You
should follow EXACTLY what your book said - follow the directory structure
and names (they're case-sensitive). It's most likely a classpath problem,
which you don't have enough knowledge about at the moment. Follow what the
book said - you'll figure it out later (the book will teach you).
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Fri Jan 02, 2004 7:13 am Post subject: Re: Newbie Squared - Can't Run At All |
|
|
"jay1000" <jfschonREMoVE (AT) yahoo (DOT) com> wrote
| Quote: | Exception in thread "main" java.lang.NoClassDefFoundError: ellsworth
|
I am lazy at the moment, my classpath is not set
and I couldn't be bothered stuffing with it, so to
get java to run, I change the usual..
java ellsworth ....to
java -cp . ellsworth ..which includes the
current directory
If that solves the problem it is almost
certainly a 'classpath' problem, but note
that class names would generally start
with a Capital letter, ellsworth -> Ellsworth,
which also seems like a rather odd name for
a class.
HTH
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
|
|
| Back to top |
|
 |
jay1000 Guest
|
Posted: Fri Jan 02, 2004 8:15 pm Post subject: Re: Newbie Squared - Can't Run At All |
|
|
"Andrew Thompson" <andrew64 (AT) bigNOSPAMpond (DOT) com> wrote
| Quote: | "jay1000" <jfschonREMoVE (AT) yahoo (DOT) com> wrote in message
news:qT2Jb.39562$Fg.32197 (AT) lakeread01 (DOT) ..
Exception in thread "main" java.lang.NoClassDefFoundError: ellsworth
I am lazy at the moment, my classpath is not set
and I couldn't be bothered stuffing with it, so to
get java to run, I change the usual..
java ellsworth ....to
java -cp . ellsworth ..which includes the
current directory
If that solves the problem it is almost
certainly a 'classpath' problem, but note
that class names would generally start
with a Capital letter, ellsworth -> Ellsworth,
which also seems like a rather odd name for
a class.
HTH
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
|
Thanks - your inclusion of current directory was the tip-off. I added my
compiled java directory to CLASSPATH and that seems to have solved the
problem. I also changed CLASSPATH to point to lib/tools.jar instead of just
lib so I don't know which fix really solved the problem - maybe both.
It's real easy to change PATH and CLASSPATH in Windows XP. Beats all that
fiddling with autoexec and config files.
Jay
|
|
| Back to top |
|
 |
jay1000 Guest
|
Posted: Mon Jan 05, 2004 6:01 am Post subject: Re: Newbie Squared - Can't Run At All |
|
|
"La?ie Techie" <laie (AT) wing_this_etsolutions (DOT) com> wrote
| Quote: | On Fri, 02 Jan 2004 15:15:04 -0500, jay1000 wrote:
Thanks - your inclusion of current directory was the tip-off. I added
my compiled java directory to CLASSPATH and that seems to have solved
the problem. I also changed CLASSPATH to point to lib/tools.jar instead
of just lib so I don't know which fix really solved the problem - maybe
both.
By default, sun's java boot classpath includes all the files in
%JAVA_HOME%lib and %JAVA_HOME%jrelib, so you don't need to explicitly
include them.
In your case, %JAVA_HOME% is C:j2sdk1.4.2_03
HTH,
La'ie Techie
My problem was I didn't know about java's boot classpath and, for |
convenience, stuck all compiled java in c:javacompiled. Seemed simpler
than using that crazy directory name. Thanks for the clarification.
Jay
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|