Two Laptop Bag
The moose likes Beginning Java and the fly likes trying to get started with head first java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "trying to get started with head first java" Watch "trying to get started with head first java" New topic

trying to get started with head first java

Carole Hagen

Joined: Mar 19, 2009
Posts: 2
I'm new to programming and my programming class is using Dr. Java. I really need something more and purchased the Head First java book 2nd Edition. I believed that I have followed the instructions on page XXVIII about how to download SDK and the API files. I also set my path. I know how to go to the command line, how can I get started to see if my compiler will run Java commands?

Thank you!
Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
type javac in the cmd prompt. This is used for compiling java files. If it is set up correctly you should get a message about how to use javac.
Carole Hagen

Joined: Mar 19, 2009
Posts: 2
I type javac into my command prompt, but I am receiving a message that says:

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

I think that means I need to set my path. I used some online instructions to do that, but I think I may have something wrong here. Here is what I have under Environmental Variables:

C:\Program Files\Java\jdk 1.6.0_11\bin C:\Program Files\Java\jdk 1.6.0_11\bin
PATH C:\Sun\SDK\bin
SYBASE c:\sql11
TEMP C:\Documents and Settings\Hagen.Carole\Local Settings\Temp
TMP C:\Documents and Settings\Hagen.Carole\Local Settings\Temp

Here is what I have under System variables
C:\Program Files\Java\jdk 1.6.0_11\bin C:\Program Files\Java\jdk 1.6.0_11\bin
CLASSPATH C:\Program Files\Java\j2re 1.4.2_06\lib\ext\
ComSpec ..............

there is more and I've attached a picture of my Environmental Variables window. If anyone knows what I'm doing wrong, please let me know. When I try HelloWorld from my command line, I can get it if I don't include 'javac' - so I'm convinced it has to do with my path. THANKS!!

fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11952

after you set the path, you have to open a new command window. If you have one already open, it won't pick up the changes.

type only the word "path" on the command line, and that will show you what THAT session thinks the path is.

something else to try is to navigate to the directory where you think java is, and see if you can run the javac command from there...

i.e. here's my path:

PATH=C:\Perl\site\bin;C:\Perl\bin;C:\PROGRA~1\REFLEC~1;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\WINDOWS\Downloaded Program Files;C:\Program Files\Altiris\Software Virtualization Agent\;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\Program Files\iPath\Bin;C:\MySQL\bin;C:\Program Files\Java\jdk1.6.0_11\bin;C:\Program Files\QuickTime\QTSystem\

so, I went to my jdk directory:

cd "Program Files\Java\jdk1.6.0_11\bin"

and then I ran javac. if you can run it from there, then you know it's installed, and you have a path problem. if it DOESN'T run from there, it's either a) not installed, or b) it's installed somewhere else.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15080

Sun's Hello World! tutorial explains step by step how to write, compile and run your first Java program.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
You seem to be getting lots of help, Carole, so I shall just say . . .

Welcome to JavaRanch
I agree. Here's the link:
subject: trying to get started with head first java
It's not a secret anymore!