Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-19-2010, 04:15 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default 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.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 03-19-2010, 04:18 PM
Senior Member
 
Join Date: Mar 2010
Posts: 605
Rep Power: 1
gcalvin is on a distinguished road
Default
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-
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 03-19-2010, 04:22 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by gcalvin View Post
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>
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 03-19-2010, 04:32 PM
Member
 
Join Date: Mar 2010
Posts: 2
Rep Power: 0
Phemosky is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 03-19-2010, 04:35 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by Phemosky View Post
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?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 03-19-2010, 04:42 PM
Senior Member
 
Join Date: Mar 2010
Posts: 269
Rep Power: 1
iluxa is on a distinguished road
Default
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
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 03-19-2010, 04:43 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by iluxa View Post
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).
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 03-19-2010, 04:47 PM
Senior Member
 
Join Date: Mar 2010
Posts: 269
Rep Power: 1
iluxa is on a distinguished road
Default
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?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 03-19-2010, 04:49 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by iluxa View Post
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.
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 03-19-2010, 05:05 PM
Member
 
Join Date: Mar 2010
Posts: 14
Rep Power: 0
karno is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 03-19-2010, 05:36 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Yeh I've already restarted - Still nothing.
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 03-19-2010, 06:11 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Anybody got any ideas?
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 03-19-2010, 06:37 PM
Senior Member
 
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
JosAH is on a distinguished road
Default
Originally Posted by Pte View Post
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
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 03-19-2010, 07:01 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by JosAH View Post
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?
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 03-19-2010, 07:49 PM
Senior Member
 
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
JosAH is on a distinguished road
Default
Originally Posted by Pte View Post
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
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 03-19-2010, 08:02 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by JosAH View Post
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.
Bookmark Post in Technorati
Reply With Quote
  #17 (permalink)  
Old 03-19-2010, 08:08 PM
Senior Member
 
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
JosAH is on a distinguished road
Default
Originally Posted by Pte View Post
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
Bookmark Post in Technorati
Reply With Quote
  #18 (permalink)  
Old 03-19-2010, 09:03 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by JosAH View Post
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.
Bookmark Post in Technorati
Reply With Quote
  #19 (permalink)  
Old 03-19-2010, 09:11 PM
Senior Member
 
Join Date: Sep 2008
Location: Voorschoten, the Netherlands
Posts: 3,322
Rep Power: 5
JosAH is on a distinguished road
Default
Originally Posted by Pte View Post
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
Bookmark Post in Technorati
Reply With Quote
  #20 (permalink)  
Old 03-19-2010, 09:18 PM
Pte Pte is offline
Member
 
Join Date: Mar 2010
Posts: 13
Rep Power: 0
Pte is on a distinguished road
Default
Originally Posted by JosAH View Post
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
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jar files and a magic error. dudejonne Java Applets 2 10-31-2009 02:28 PM
Running batch files thraugh java by passing parameters pradeesh New To Java 1 01-16-2009 10:14 AM
Batch Files in java coco New To Java 3 12-05-2008 01:30 PM
Running batch files in java pradeesh New To Java 10 12-04-2008 09:26 PM
error in Java files ai_2007 Advanced Java 1 07-31-2007 12:14 PM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 09:16 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org