
03-19-2010, 04:15 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Keep getting this error when i run batch files....
Can anybody help me to fix this proble, whenever i ru a batch file that uses java i get this error;
"java is not recognized as an internal or external command"
I have done research online on how to fix this and anything anybody says doesn't work - i've tried editring the paths and such and nothing works... I have jdk1.6.0_18 installed correctly i believe - And i believe this error only happens when there is a problem with my path anyways, it is not a problem to do with java being installed..
My path is currently set to this- C:\Program Files\Java\jdk1.6.0_18\bin;
So can anyone hlep me? As i really need to get this sorted out ASAP.
Thanks.
Last edited by Pte; 03-19-2010 at 04:19 PM.
|
|

03-19-2010, 04:18 PM
|
|
Senior Member
|
|
Join Date: Mar 2010
Posts: 605
Rep Power: 1
|
|
|
Show us your batch file, tell us what OS and version you're running (I'm guessing Windows), and tell us what ECHO %PATH% (if it's Windows) or echo $PATH (if it's Linux/UNIX) says. Also tell us what happens if you just type "java" at a command prompt.
-Gary-
|
|

03-19-2010, 04:22 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by gcalvin
|
Show us your batch file, tell us what OS and version you're running (I'm guessing Windows), and tell us what ECHO %PATH% (if it's Windows) or echo $PATH (if it's Linux/UNIX) says. Also tell us what happens if you just type "java" at a command prompt.
-Gary-
|
It is any batch file i run...Even if i type into cmd java-version i get this error.
Im using Vista 64bit
What is my echo path?
When i type java in CMD i get this;
Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\Users\p>java Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -server to select the "server" VM -hotspot is a synonym for the "server" VM [deprecated] The default VM is server. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A ; separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -version:<value> require the specified version to run -showversion print product version and continue -jre-restrict-search | -jre-no-restrict-search include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument -splash:<imagepath> show splash screen with specified image C:\Users\p>
|
|

03-19-2010, 04:32 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 2
Rep Power: 0
|
|
|
i am also new to java programming, but when i had mine sorted last week at my training center by my faculty,i think you need to go to you computer properties and then click the enviroment variable and choose the upper one and the click add new and then type classpath and this ,; then ok all, and check.
|
|

03-19-2010, 04:35 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by Phemosky
|
|
i am also new to java programming, but when i had mine sorted last week at my training center by my faculty,i think you need to go to you computer properties and then click the enviroment variable and choose the upper one and the click add new and then type classpath and this ,; then ok all, and check.
|
What does the ,; stnad for?
|
|

03-19-2010, 04:42 PM
|
|
Senior Member
|
|
Join Date: Mar 2010
Posts: 269
Rep Power: 1
|
|
|
How did you update your PATH variable? did you go through My Computer->Properties->Advanced->Environment Variables? If you do it any other way, your PATH wont stick
|
|

03-19-2010, 04:43 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by iluxa
|
|
How did you update your PATH variable? did you go through My Computer->Properties->Advanced->Environment Variables? If you do it any other way, your PATH wont stick
|
I went My Computer->System->Advanced system settings->Environment Variables
(I tihnk the way u said is for XP, nto vista).
|
|

03-19-2010, 04:47 PM
|
|
Senior Member
|
|
Join Date: Mar 2010
Posts: 269
Rep Power: 1
|
|
|
Mk... "java" works for you, but "java-version" doesn't... that shouldn't be...
you're leaving a space between "java" and "-version", right? so you're typing "java -version"? Can you actually show us a batch file that doesnt work for you?
|
|

03-19-2010, 04:49 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by iluxa
|
Mk... "java" works for you, but "java-version" doesn't... that shouldn't be...
you're leaving a space between "java" and "-version", right? so you're typing "java -version"? Can you actually show us a batch file that doesnt work for you?
|
Yes im typing Java-Version. And i've had this problem for a wihle now on several games i've tried to compile using batch files. I have deleted them now. But it still grinds on me that the problem iss till there as i will need to resolve it sometime. The problem is definately my PC not the batch files.
|
|

03-19-2010, 05:05 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 14
Rep Power: 0
|
|
|
after you edit a path variable in your computer by adding C:\Program Files\Java\jdk1.6.0_18\bin; in path variable ..
may you need to restart your computer.....
good luck..
Last edited by karno; 03-19-2010 at 05:09 PM.
|
|

03-19-2010, 05:36 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
|
Yeh I've already restarted - Still nothing.
|
|

03-19-2010, 06:11 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
|
Anybody got any ideas?
|
|

03-19-2010, 06:37 PM
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
|
|
Originally Posted by Pte
|
|
Anybody got any ideas?
|
What happens when you type the full path of the javac executable? i.e. c:\Program Files\java\ ... \javac -version.
Can your cmd/shell find it? If so there's a typo in your PATH list, if not, check your directory names.
kind regards,
Jos
|
|

03-19-2010, 07:01 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by JosAH
|
What happens when you type the full path of the javac executable? i.e. c:\Program Files\java\ ... \javac -version.
Can your cmd/shell find it? If so there's a typo in your PATH list, if not, check your directory names.
kind regards,
Jos
|
When i type what the location of my java in cmd i get the same error.
And what exactly do i need to check about my directory names?
|
|

03-19-2010, 07:49 PM
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
|
|
Originally Posted by Pte
|
|
When i type what the location of my java in cmd i get the same error.
|
You did install the JDK (not just the JRE) did you? (check if the directory is actually there)
kind regards,
Jos
|
|

03-19-2010, 08:02 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by JosAH
|
You did install the JDK (not just the JRE) did you? (check if the directory is actually there)
kind regards,
Jos
|
Yes i have a JDK.######## & also JRE 6. Still nothing.
I also have a Programfiles (X86) folder too with a Java folder, i don't know why. But that jst has JRE6 in for some reason..
Last edited by Pte; 03-19-2010 at 08:07 PM.
|
|

03-19-2010, 08:08 PM
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
|
|
Originally Posted by Pte
|
|
Yes i have a JDK.######## & also JRE 6. Still nothing.
|
You must be making typing errors; cd to the bin directory where your javac.exe is stored and type "javac -version"; if that works put the directory where you're in in your PATH variable and try again. If that works, move to your root (out of that directory) and try again. A step by step approach (baby steps preferably) usually solves your problems.
kind regards,
Jos
|
|

03-19-2010, 09:03 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by JosAH
|
You must be making typing errors; cd to the bin directory where your javac.exe is stored and type "javac -version"; if that works put the directory where you're in in your PATH variable and try again. If that works, move to your root (out of that directory) and try again. A step by step approach (baby steps preferably) usually solves your problems.
kind regards,
Jos
|
DO u have MSN? It would be easier talking there, im not tottaly sure what you mean now.
|
|

03-19-2010, 09:11 PM
|
|
Senior Member
|
|
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
|
|
Originally Posted by Pte
|
|
DO u have MSN? It would be easier talking there, im not tottaly sure what you mean now.
|
We can do it through this forum; go to the directory where your javac.exe is stored. Can you go there and see that file?
If so, type "javac -version"; if that works put that directory (where you're in at that moment) in your PATH variable.
Now move somewhere else and type "javac -version" again; does that still work?
kind regards,
Jos
|
|

03-19-2010, 09:18 PM
|
|
Member
|
|
Join Date: Mar 2010
Posts: 13
Rep Power: 0
|
|
Originally Posted by JosAH
|
We can do it through this forum; go to the directory where your javac.exe is stored. Can you go there and see that file?
If so, type "javac -version"; if that works put that directory (where you're in at that moment) in your PATH variable.
Now move somewhere else and type "javac -version" again; does that still work?
kind regards,
Jos
|
Sorry i can't find my javac.exe....I can find the javac folder and inside there there is a few other folders but that just takes me to a java document.... and were am i typing javac-version? Into cmd??
sorry to sound newbi but im a bit lost; if u can explain it simply i will know how to do it.
thanks
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 09:16 PM.
|
|