my run program does not work
so i made a compile and run program in notepad so that i can compile and run my java programs but for some reason my run program doesn't work. whenever i run it, it says: "Could not find the main class: hello. program will exit.".
this is what i have coded in note pad for run.bat:
@echo off
echo Please wait, running......
java hello
pause
i have jdk 1.6.0_16 installed and i'm pretty sure that the classpath and path are correct so i'm not sure whats going on.
CLASSPATH: C:\Program Files\Java\jdk1.6.0_16\bin
PATH: C:\Program Files\Java\jdk1.6.0_16\bin
yes, the class has the same name as the file.
thanks
Re: my run program does not work
mmm... command line java :(
I'd get an IDE like Eclipse or Netbeans. That will fix all your pathing problems ;) (well, not all, but pretty close)
Re: my run program does not work
Hi rman27bn,
With error: "Could not find the main class", I think that your "hello" class don't have a main function.
Such as:
Code :
class hello
{
//----------------
public static void main(String args[])
{
}
//----------------
}
Another comment to you that if you want to use command line to compile java program, you should make a file .bat as:
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_16\bin
REM call when compile ----
%JAVE_HOME%\java.exe filename
You can learn batch script language to more.
Good luck,
Tien
Re: my run program does not work
Quote:
Originally Posted by
tien1504
Hi rman27bn,
With error: "Could not find the main class", I think that your "hello" class don't have a main function.
Such as:
Code :
class hello
{
//----------------
public static void main(String args[])
{
}
//----------------
}
Another comment to you that if you want to use command line to compile java program, you should make a file
.bat as:
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_16\bin
REM call when compile ----
%JAVE_HOME%\java.exe filename
You can learn batch script language to more.
Good luck,
Tien
He has already set his PATH environment variable, so he has no need to fiddle around with JAVA_HOME etc etc.
I'd guess that what you said first i correct, of course the class must also be public,
@OP
perhaps share some code with us? so we can see what you have?
Chris