Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running java from the command prompt window

 
Es Tresidder
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I've done a tiny bit of java from netbeans, but need to learn it to a much higher level. I've started the "Head First Java" book, which recommends that you do the exercises with a simple text editor and use the javac compiler. So I've been following the instructions here (http://download.oracle.com/javase/tutorial/getStarted/cupojava/win32.html) for doing the "hello world" app with text files and from the command prompt. I can get into the java directory and see the file I've saved there, but when I type "javac HelloWorldApp.java" I get the following error message: ' javac' is not recognized as an internal or external command, operable program or batch file.

So what am I doing wrong?

Thanks in advance

Es
 
Francis Zabala
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Es Tresidder! I am a noobie myself but I got that problem to. Here's what you are going.

Go to Start -> Control Panel -> System -> "Advanced" Tab

Then click on the Environment Variables button, there will be two tables there, look at the bottom and find where it says "Path".

Select it, then click on edit. You should now see two text boxes one saying Variable Name and the other Variable value:

Here's what I have:
C:\PROGRA~1\Ticomm;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;C:\Program Files\Windows Imaging\;%HummPATH%;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;%JAD_HOME%;C:\Program Files\Java\jdk1.6.0_20\bin

The bold one is the one you need to add after your value. Please note that that is where my java is installed.

I have got the feeling that you are not using Windows XP... hehehe

By the way, after doing that, close all command prompts and open it up again.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Es and Francis.

Note that the problem that you get is one of the things mentioned in Common Problems (and Their Solutions) which is at the bottom of the tutorial page.

The JDK installation instructions (step 4) also explain how to set your PATH.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic