Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command line troubles (VISTA)

    Hey all,

    I usually code and compile using a shell like textpad or netbeans, but have recently been trying to feed the command line some simple commands.

    Unfortunately it responds to my javac commands by saying:

    C:\Java\MP1>javac BgArray.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    Does anyone know how to solve this? The editor-programs have no problem compiling and running java

    thanks!!

  • #2
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    The javac program is most likely not in your windows path. Check the path environment variable and make sure the bin directory of your JDK installation is listed.

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    tnx

    i cant seem to figure out how to set the environment variables in vista. according to a tutorial im doing, im supposed to get access them through the control panel, but cant seem to figure out how

    if anyone could point me in the right direction, that d be great!

  • #4
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Please follow these steps...

    1- Right Click on My Computer on your desktop and click on Properties
    2- Computer Properties Window will open....Click on Advanced System Settings
    3- Click ok when the stupid administrator window appears (Personally I have disabled them...as I find them annoying and pointless)
    4- Click on Environment Variables
    5- Under the Systems Variables, click the NEW button to create a new Variable
    6- Enter the following inside the dialog
    Variable Name: JAVA_HOME
    Variable Value: FOLDER_CONTAINING_JAVA_INSTALLATION for example C:\Program Files\Java\jdk1.6.0_02
    7- Inside the Systems Variables, locate the Path entry. Select it...then click on the edit button
    8- At the end of the PATH, enter a semi column if there is NOT one there already
    9- At the end of the PATH variable, enter %JAVA_HOME%\bin;

    Click on Apply and ok buttons to close all opened dialogs

    Start a new (if you have one opened already...it won't work) prompt or MS Dos command prompt and type the following

    Code:
    java -version
    You should see details of the installed version of Java etc. once you hit the RETURN key

    Within the command prompt, type the following

    Code:
    notepad Hello.java
    Paste the following inside it

    Code:
    public class Hello { 
       public static void main(String [] args) { 
          System.out.println("Hello World ;)");
       }
    }
    save the file and exit notepad

    at the command prompt type the following

    Code:
    javac Hello.java
    If no errors are generated, type the following

    Code:
    java Hello
    Cheers
    ~E
    Last edited by Aradon; 09-04-2008 at 11:39 AM. Reason: Changed so it can be added to the FAQ w/o ess getting pm's all the time.

  • #5
    New to the CF scene
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I've been having a same problem as Noobathon for quite a long time now. I've taken the exact steps described in ess's reply, but it doesn't fix the problem - I'm still getting the "javac is not recognized as an internal or external command" message when trying to compile files with javac. I've also tried restarting the computer after setting the environment variables. Javac works perfectly in Windows XP, the problem appears only with Vista.

    I would be grateful if somebody would be able to help.

  • #6
    New to the CF scene
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Anybody?

  • #7
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    Go to the command line, type "set" as the command, and print the output here so we can see the environment variables that are set up on your system.

    You will also need to ensure that you have installed a JDK, not just the JRE.

  • #8
    New to the CF scene
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    'Set' gives the following output. It seems quite similar to my Win XP machine, in which everything works just fine.

    C:\Users\Sami>set

    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\Sami\AppData\Roaming
    CLASSPATH=C:\Program Files\Java\jdk1.6.0_07\bin
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=SAMI-PC
    ComSpec=C:\Windows\system32\cmd.exe
    configsetroot=C:\Windows\ConfigSetRoot
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Users\Sami
    LOCALAPPDATA=C:\Users\Sami\AppData\Local
    LOGONSERVER=\\SAMI-PC
    NUMBER_OF_PROCESSORS=2
    OS=Windows_NT
    Path=C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Program Files\Java\jdk1.6.0_07\bin; C:\Program Files\Microsoft SQL S
    erver\90\Tools\binn\; C:\Program Files\MATLAB\R2008a\bin; C:\Program Files\MATLAB\R2008a\bin\win32; C:\Program Files\SSH Communicatio
    ns Security\SSH Tectia\SSH Tectia AUX; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia AUX/Support binaries; C:\Prog
    ram Files\SSH Communications Security\SSH Tectia\SSH Tectia Broker; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia
    Client; ;C:\Program Files\jprofiler5\bin\windows; C:\Program Files\Java\jdk1.6.0_07\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 10, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=0f0a
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    PUBLIC=C:\Users\Public
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\Sami\AppData\Local\Temp
    TMP=C:\Users\Sami\AppData\Local\Temp
    USERDOMAIN=Sami-PC
    USERNAME=Sami
    USERPROFILE=C:\Users\Sami
    VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
    windir=C:\Windows

  • #9
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    On the third line, you have

    Code:
    CLASSPATH=C:\Program Files\Java\jdk1.6.0_07\bin
    That is not correct, please change it to

    Code:
    CLASS_PATH=.;
    Yes, a dot and a semicolon

    The PATH variable is fine, though, I would add a semicolon at the end....but should work as is.

    Let's know if that worked for you.

    Cheers
    ~E

  • #10
    New to the CF scene
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Still not working. I also added that extra semicolon in the end, but as assumed, didn't help... Damn Vista. Here's the current set output:

    C:\Users>set

    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\Sami\AppData\Roaming
    CLASS_PATH=.;
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=SAMI-PC
    ComSpec=C:\Windows\system32\cmd.exe
    configsetroot=C:\Windows\ConfigSetRoot
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Users\Sami
    LOCALAPPDATA=C:\Users\Sami\AppData\Local
    LOGONSERVER=\\SAMI-PC
    NUMBER_OF_PROCESSORS=2
    OS=Windows_NT
    Path=C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Program Files\Java\jdk1.6.0_07\bin; C:\Program Files\Microsoft SQL S
    erver\90\Tools\binn\; C:\Program Files\MATLAB\R2008a\bin; C:\Program Files\MATLAB\R2008a\bin\win32; C:\Program Files\SSH Communicatio
    ns Security\SSH Tectia\SSH Tectia AUX; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia AUX\Support binaries; C:\Prog
    ram Files\SSH Communications Security\SSH Tectia\SSH Tectia Broker; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia
    Client; ;C:\Program Files\jprofiler5\bin\windows; C:\Program Files\Java\jdk1.6.0_07\bin;
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 10, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=0f0a
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    PUBLIC=C:\Users\Public
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\Sami\AppData\Local\Temp
    TMP=C:\Users\Sami\AppData\Local\Temp
    USERDOMAIN=Sami-PC
    USERNAME=Sami
    USERPROFILE=C:\Users\Sami
    VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
    windir=C:\Windows
    Last edited by sorbetti; 09-03-2008 at 07:31 PM.

  • #11
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Not sure if this will help at all, but I've noticed two things.

    1- You have TWO entries of JVM on your path. I think you're ought to have one only.
    2- You have TWO semicolons just before the last two entries on you path, please remove one.

    Let's know if this helped at all.

    Cheers
    ~E

  • #12
    New to the CF scene
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I had two entries, because I added path to jdk into both account and system specific environment variables. Extra semicolon seems to be a separator of those two. I now removed the account specific variable, but still not working...


    C:\Users\Sami>set
    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\Sami\AppData\Roaming
    CLASS_PATH=.;
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=SAMI-PC
    ComSpec=C:\Windows\system32\cmd.exe
    configsetroot=C:\Windows\ConfigSetRoot
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Users\Sami
    LOCALAPPDATA=C:\Users\Sami\AppData\Local
    LOGONSERVER=\\SAMI-PC
    NUMBER_OF_PROCESSORS=2
    OS=Windows_NT
    Path=C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Program Files\Java\jdk1.6.0_07\bin; C:\Program Files\Microsoft SQL S
    erver\90\Tools\binn\; C:\Program Files\MATLAB\R2008a\bin; C:\Program Files\MATLAB\R2008a\bin\win32; C:\Program Files\SSH Communicatio
    ns Security\SSH Tectia\SSH Tectia AUX; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia AUX\Support binaries; C:\Prog
    ram Files\SSH Communications Security\SSH Tectia\SSH Tectia Broker; C:\Program Files\SSH Communications Security\SSH Tectia\SSH Tectia
    Client; C:\Program Files\jprofiler5\bin\windows;
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 10, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=0f0a
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    PUBLIC=C:\Users\Public
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\Sami\AppData\Local\Temp
    TMP=C:\Users\Sami\AppData\Local\Temp
    USERDOMAIN=Sami-PC
    USERNAME=Sami
    USERPROFILE=C:\Users\Sami
    VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
    windir=C:\Windows

  • #13
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    Does the java command work?

    Try "java -version" and see what the output is, verify that its the same version you would expect.

  • #14
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    This is really strange...as your settings are in order.

    do you mind trying something out for us please.

    1- Navigate to C:\Program Files\Java\jdk1.6.0_07\bin inside the command prompt or MS-DOS if you like
    2- Type javac and hit the return key

    If you get the following output

    Code:
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    It means that your Java installation was not successful...and you need to download a fresh copy and install from scratch.

    If you get something that starts with
    Code:
    Usage: javac <options> <source files>.....
    Your Java installation is fine...and we need to look for something else that could be causing the problem.

    Cheers
    ~E

  • #15
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    May also try installing java to a directory other than under 'Program Files', sometimes the space in the directory names throws things off, this may be what is happening in your system.

    Try a new installation under a directory like C:/java and point the path variable at that instead.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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