Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    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.

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    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-

  3. #3
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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>

  4. #4
    Phemosky is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    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.

  5. #5
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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?

  6. #6
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    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

  7. #7
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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).

  8. #8
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    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?

  9. #9
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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.

  10. #10
    karno is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    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.

  11. #11
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Yeh I've already restarted - Still nothing.

  12. #12
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Anybody got any ideas?

  13. #13
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote 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

  14. #14
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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?

  15. #15
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote 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

  16. #16
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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.

  17. #17
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote 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

  18. #18
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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.

  19. #19
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote 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

  20. #20
    Pte
    Pte is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote 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

Page 1 of 2 12 LastLast

Similar Threads

  1. Jar files and a magic error.
    By dudejonne in forum Java Applets
    Replies: 2
    Last Post: 10-31-2009, 02:28 PM
  2. Replies: 1
    Last Post: 01-16-2009, 10:14 AM
  3. Batch Files in java
    By coco in forum New To Java
    Replies: 3
    Last Post: 12-05-2008, 01:30 PM
  4. Running batch files in java
    By pradeesh in forum New To Java
    Replies: 10
    Last Post: 12-04-2008, 09:26 PM
  5. error in Java files
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •