Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: can't run javac directly from command prompt

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default can't run javac directly from command prompt

    Hi, I use Win Vista and every time I try to compile X.java via javac X.java command via command prompt I get 'javac' is not recognized then I have to go to " C:\Program Files\Java\jdk1.6.0_05\bin" and from there type javac X.java to work, what should I do to make the javac work every where?

    thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: can't run javac directly from command prompt

    The OS can not find the javac.exe command. You either need to add the path to the javac.exe file to the PATH environment variable or you need to use the full path to the compiler when you try to execute it.

  3. The Following User Says Thank You to Norm For This Useful Post:

    epezhman (July 14th, 2010)

  4. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: can't run javac directly from command prompt

    Quote Originally Posted by Norm View Post
    The OS can not find the javac.exe command. You either need to add the path to the javac.exe file to the PATH environment variable or you need to use the full path to the compiler when you try to execute it.
    thanks it worked

  5. #4
    Junior Member
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: can't run javac directly from command prompt

    I'm still having trouble with the same issue. I'm running on windows Vista, and even though I have all that in my environmental variables, I'm still getting the message about javac not being a command. When I input it as an environmental variable it asks for name and value, do I need a specific name for the variable? I'm certain my path(value) is correct (C:\Program Files\Java\jdk1.6.0_11\bin). Can anyone help?

  6. #5
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: can't run javac directly from command prompt

    Have you logged off/logged back on? Windows won't update the environment variables when you're logged in.

  7. #6
    Junior Member
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: can't run javac directly from command prompt

    hmmm Ii just tried logging out and even restarting my computer and i still cant get it to work. hmmm
    how do you have it written in your environmental variables? Maybe I've done something wrong there.

  8. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: can't run javac directly from command prompt

    Show us what you have: Open a command prompt window, enter: Path, copy and paste the contents of the window here showing what your settings are.
    Here are mine:
    E:\Realtime>path
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;C:\Perl\bin;C:\Prog
    ram Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft
    Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common
    \Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;D:\Java\jdk1.6.0_02\bin
    \;C:\BatchFiles\;C:\Program Files\Common Files\Nero\Lib\

  9. #8
    Junior Member
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: can't run javac directly from command prompt

    I'm sorry, now I feel like an idiot. I had understood the instructions wrong, instead of editing the "Path" variable i was trying to make a new variable. It works just fine now, thanks for all your time and patience with me. Thanks all of you

Similar Threads

  1. Run 2 systems command in applet, how?
    By bulgin in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 8th, 2010, 03:11 PM
  2. how do I keep a persistent prompt in JTextArea and allow user input
    By cazmo in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 23rd, 2010, 01:14 PM
  3. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM
  4. opening Telnet Command Session
    By voyager in forum Java Networking
    Replies: 3
    Last Post: June 23rd, 2009, 10:34 AM
  5. Problem of executing java.exe. How to code from absolute scratch?
    By sepalm in forum Java Theory & Questions
    Replies: 13
    Last Post: November 12th, 2008, 07:48 AM