Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 09-06-2009, 06:50 PM   #1 (permalink)
Registered User
 
Join Date: Jan 2008
Posts: 47
OS: xp sp2


[SOLVED] Java command prompt problem

I am learning to program in Java using the JDK, the notepad, and the windows command prompt. Every time I try to use the javac command, it says:

'javac' is not recognized as an internal or external command, operable program or batch file.

I have been able to get it to compile by putting the whole path in manually like this:

"C:\Program Files\Java\jdk1.6.0_16\bin\javac" Hello.java

The teacher anticipated that we would get this sort of problem so he posted this as a fix:

Quote:
If this works (Windows can now find javac), then Java is installed correctly. Now you can update your path so you don't have to type the whole path name every time. These are the steps to do this in WindowsXP (some translation may be required for Vista):

1. Go to Start -> Control Panel -> System. (It's easiest to find System when you change Control Panel to Classic View.)
2. Go to the Advanced tab
3. Click the Environment Variables button
4. Scroll down through the System variables until you find Path.
5. Edit this variable, adding the path up to but not include javac (so probably C:\Program Files\Java\jdk1.6.0_16\bin\) to the end of the list. Make sure there is a ; (semi-colon) between this path and the one before it.
6. Click OK for all of that, saving it all.
7. Now open a new command prompt and see if just javac -version or javac Hello.java works, without the whole path.
I have tried doing this but it still won't work. It gives the same error. I think I did it correctly in the first image. And the other image has the folder containing javac.exe, and the path at the top.
Attached Images
File Type: png Path.png (31.1 KB, 6 views)
File Type: jpg Java.jpg (54.9 KB, 4 views)
Tecnoob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 09-07-2009, 11:44 PM   #2 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 905
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Java command prompt problem

Have you tried it with the extension? i.e. 'javac.exe' instead of just 'javac'?
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-07-2009, 11:48 PM   #3 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 834
OS: MS-Dos 6.22 - Win7


Re: Java command prompt problem

It looks to me like you have a space between the ; and the C:\Program Files\Java\jdk1.6.0_16\bin\.
If there is a space there it won't work
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-07-2009, 11:51 PM   #4 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 905
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Java command prompt problem

So it's "\;C:\Program Files\Java\jdk1.6.0_16\bin\javac" right? I've never used notepad to compile java. Now that I'm running a linux box it will likely never happen :-P
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-08-2009, 01:14 AM   #5 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 834
OS: MS-Dos 6.22 - Win7


Re: Java command prompt problem

Yes, no space after the ;
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-08-2009, 02:28 AM   #6 (permalink)
Registered User
 
Join Date: Jan 2008
Posts: 47
OS: xp sp2


Re: Java command prompt problem

Thanks, it works now.
Tecnoob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-08-2009, 02:40 AM   #7 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 834
OS: MS-Dos 6.22 - Win7


Re: Java command prompt problem

Quote:
Originally Posted by ahmorrow View Post
So it's "\;C:\Program Files\Java\jdk1.6.0_16\bin\javac" right? I've never used notepad to compile java. Now that I'm running a linux box it will likely never happen :-P
Opps, missed the tail end of this, it just \;C:\Program Files\Java\jdk1.6.0_16\bin
The trailing slash is optional, it can be omitted or left in, but you can't include the file name javac. The path statement is always just folders. And there is more to the left of the first \, it's just not visible in the screen shot. At a minimum you would have this for the Path variable in Windows:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Java\jdk1.6.0_16\bin


Glad it's working for you now Tecnoob!

If your issue has been resolved you can mark this thread Solved by using the Thread Tools at the Top Right of this thread (above the first post)

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-08-2009, 01:43 PM   #8 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 905
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: [SOLVED] Java command prompt problem

Sweet... I'll keep this in mind if I EVER switch back to a PC. Not likely, but good to know.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

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 Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 07:10 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85