|
-
Dec 25th, 2001, 08:25 PM
#1
Thread Starter
Fanatic Member
im trying to get started.
i downloaded the compilers for java and i finnaly figured out how to compile a .java file. but i cant seem to be able to run the file. how do i do this? i have my .java file and .class file in my C drive do the paths to them are C:\Hello.java and C:\Hello.class
i tried typing in "java Hello" but it gave me and error.
FlameWave Technologies - internet tools
-
Dec 25th, 2001, 08:34 PM
#2
Re: im trying to get started.
Originally posted by flamewavetech
i tried typing in "java Hello" but it gave me and error.
What error would that be?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 25th, 2001, 08:43 PM
#3
Thread Starter
Fanatic Member
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
FlameWave Technologies - internet tools
-
Dec 25th, 2001, 08:46 PM
#4
and you were in c:\ when you tried to run it? Did you package it?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 25th, 2001, 09:00 PM
#5
Thread Starter
Fanatic Member
what do u mean? i just went to run and typed in command and then typed in java Hello
FlameWave Technologies - internet tools
-
Dec 25th, 2001, 09:05 PM
#6
well, if you don't know what packaging is, then its probably not the problem . But, as far as where you are in at the command line...if you have the .class file in c:\ and you are in c:\windows when you type in "java Hello", then it won't work. That's what I meant. It seems like a stupid mistake to make, but it happens sometimes.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 26th, 2001, 07:14 PM
#7
Member
the jvm can't find your .class file because you didn't specify the classpath (path of the directory where your class files are)
type this instead
java -classpath c:\ Hello
-
Dec 28th, 2001, 02:55 AM
#8
Dazed Member
Yeah flamewavetech you have to use either the -classpath comamand line switch ie........ C:\ java -classpath C:\MyClassDir; myProg or set the CLASSPATH environment variable in your autoexec.bat file. *~Note if you change your autoexec.bat file you have to reboot in order for the changes to take effect.
-
Dec 28th, 2001, 05:58 AM
#9
Hyperactive Member
Originally posted by Dilenger4
*~Note if you change your autoexec.bat file you have to reboot in order for the changes to take effect.
nah, just call the autoexec again at the command line
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Dec 28th, 2001, 10:18 AM
#10
NT/2000/XP don't have Autoexec.bat. You will have to use Environment tab from the System control applet (or press Windows Key + Pause)
-
Dec 28th, 2001, 10:48 AM
#11
Lively Member
Remember to put a . (dot) after the last path in the classpath or Java can't see your current folder
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|