• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

running java from the command prompt window

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic