java' is not recognized

Hello;

i run my code on Dos command, and it give me the following error massage, could anyone tell

me how to fix it. butI have not problem to run my code with the JCreator editor.

java' is not recognized

The following are all the works i have done in Dos.

E:\Java>java -version

'java' is not recognized as an internal or external command,

operable program or batch file.

E:\Java>echo %path%

C:\j2sdk1.4.2_10\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Commo

n Files\Adobe\AGL;C:\Program Files\Microsoft SQL Server\80\Tools\BINN

E:\Java>set path=%path%;c:\j2sdk1.4.2\bin

E:\Java>java -classpath=.;sqljdbc.jar MyTest.java

'java' is not recognized as an internal or external command,

operable program or batch file.

In the user variable, i set the a calss path for the j2sdk is

c:\j2sdk1.4.2\jre\javaws (without quote)

and for the java run time envirament is

c:\Program Files\Java\j2re1.4.2\javaws

[1056 byte] By [kamkam2a] at [2007-11-26 17:03:39]
# 1
You'd be better off NOT setting the class path, and setting the path to point to the jdk bin directory. See http://java.sun.com/j2se/1.4.2/install-windows.html
duckbilla at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 2
The only way that this is not going to work is if "c:\j2sdk1.4.2\bin" is not a valid path. Can you cd to that directory from the prompt?
gimbal2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 3
sorry, how i change path from C:\Documents and Settings\kam> to c:\j2sdk1.4.2\bin from Dos, please
kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 4

Directory of C:\j2sdk1.4.2_13\bin

02/02/2007 07:15 PM<DIR> .

02/02/2007 07:15 PM<DIR> ..

18/10/2006 11:21 AM45,187 appletviewer.exe

18/10/2006 11:42 AM32,881 beanreg.dll

18/10/2006 11:21 AM45,185 extcheck.exe

18/10/2006 11:42 AM16,384 HtmlConverter.exe

18/10/2006 11:21 AM45,187 idlj.exe

18/10/2006 11:21 AM45,168 jar.exe

18/10/2006 11:21 AM45,189 jarsigner.exe

18/10/2006 11:21 AM45,161 java.exe

18/10/2006 11:21 AM45,182 javac.exe

18/10/2006 11:21 AM45,188 javadoc.exe

18/10/2006 11:21 AM45,182 javah.exe

18/10/2006 11:21 AM45,178 javap.exe

18/10/2006 11:21 AM45,163 javaw.exe

18/10/2006 11:21 AM45,191 jdb.exe

18/10/2006 11:21 AM45,185 keytool.exe

18/10/2006 11:21 AM45,181 kinit.exe

18/10/2006 11:21 AM45,181 klist.exe

18/10/2006 11:21 AM45,179 ktab.exe

18/10/2006 11:21 AM45,199 native2ascii.exe

18/10/2006 11:21 AM45,204 orbd.exe

18/10/2006 11:42 AM65,651 packager.exe

18/10/2006 11:21 AM45,191 policytool.exe

18/10/2006 11:21 AM45,173 rmic.exe

18/10/2006 11:21 AM45,179 rmid.exe

18/10/2006 11:21 AM45,191 rmiregistry.exe

18/10/2006 11:21 AM45,190 serialver.exe

18/10/2006 11:21 AM45,216 servertool.exe

18/10/2006 11:21 AM45,206 tnameserv.exe

28 File(s)1,244,552 bytes

2 Dir(s)6,891,196,416 bytes free

kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 5
sorry duckbill ;i could not get usefull detail from your link.
kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 6

After i installed the JDK file, i still could not compile from Dos.

The following are all the work i done;

E:\Java>java -version

'java' is not recognized as an internal or external command,

operable program or batch file.

E:\Java>echo %path%

C:\j2sdk1.4.2_10\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Commo

n Files\Adobe\AGL;C:\Program Files\Microsoft SQL Server\80\Tools\BINN

E:\Java>javac MyTest.java

'javac' is not recognized as an internal or external command,

operable program or batch file.

i downloaded the JDK from following;

https://sdlc5c.sun.com/ECom/EComActionServlet/DownloadPage:~:com.sun.sunit.sdlc.content.DownloadPageInfo;jsessionid=D557ED2AF41724D50CEB5D644B7EA3 63;jsessionid=D557ED2AF41724D50CEB5D644B7EA363

Windows Platform - J2SE(TM) Development Kit 5.0 Update 11

jdk-1_5_0_11-windows-i586-p.exe

and i installed it to the path of "C:\Program Files\Java\jdk1.5.0_11".

and i set the classpath for it as;

C:\Program Files\Java\jdk1.5.0_11\bin

Could you help me to find out why it still not work.

kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 7

>and i set the classpath for it as;

>C:\Program Files\Java\jdk1.5.0_11\bin

The link I gave you explained the process of updating the PATH (not classpath) variable through control panel -> system -> environment variables. Add the directory path of the jdk 5 bin directory (as above) to that variable using the procedure in the link I gave you! And be sure to remove the old jdk1.4 entry from the PATH variable as well.

Jukka

duckbilla at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 8
Hi duckbill ;Thanks a lot, it does work now.I did not realise to download a JDK for compile before, that' why i could not compile my code on Dos.
kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 9
I realize you got it working, but the problem was the path. Your path was c:\j2sdk1.4.2_10\bin, but your directory listing was for c:\j2sdk1.4.2_13\binObviously not the same.~Tim
SomeoneElsea at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...
# 10

>I realize you got it working, but the problem was the path. Your path was >c:\j2sdk1.4.2_10\bin, but your directory listing was for c:\j2sdk1.4.2_13\bin

>Obviously not the same.

So you means the sdk includes the jdk already ? But i could not find a folder name as jdk from sdk.

kamkam2a at 2007-7-8 23:31:25 > top of Java-index,Java Essentials,New To Java...