Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Newbie  RSS feed

 
Ginger Jarr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning Java using Head First Java by Sierra/Bates.
Cannot get to "first base" because on page xxvii I don't understand what is meant by "you ned to add an entry to your PATH environment variable that points to the/bin directory inside the main Java directory."

They then give example.

how do I do this? I really wanna get started this week.

Thanks!
GJ
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ginger,
Welcome to JavaRanch!

In Windows XP, you can edit the path as follows:

1) Right click My Computer
2) Click properties
3) Click on the advanced tab
4) Click the environment variables button
5) Edit the variable that says PATH as described in the book.

If you are using a different operating system, post which one as a reply to this thread.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The above instructions are for Windows XP. If you are using a different operating system, please let us know so that we can give you the proper instructions for that OS.

Layne
 
Ginger Jarr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't seem to find that particular path. P
erhaps I haven't unzipped and installed the j2sdk yet.
I do find "C:\Program Files\JavaSoft\JRE\1.3.1_03\lib\ext\QTJava.zip" but the book refers to j2sdk1.50.
Is this the same thing?

Thanks,
GJ
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The path that you just described is for the JRE (Java Runtime Environment) although that particular file is not helpful. The JRE will only RUN Java programs, but not COMPILE them. You need the JDK (Java Development Kit) in order to compile the programs you write. The latest version is 1.5. Did you download this and install it? What directory did you install it to? If you haven't installed it yet, then your book might come with a CD with it or you can download ithere. You may want to check if it is installed by using the Windows Search tool to find files named "javac.exe" and "java.exe".

Please let me know if this helps.

Layne
 
Ginger Jarr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thought I unzipped it but all I see in the section you directed me to is JRE. Then I found the j2se icon and installed and got a message it is already installed.

If it is already installed why isn't the path showing up ?

GJ
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is it installed? Search for the "javac.exe" file to find out. The directory that contains this file needs to be included in the PATH environment variable. Once you find this file, follow the instructions above to modify the PATH.

Layne
 
Ginger Jarr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha. The search turned up C:\Program Files\Java\jdk1.5.0_04\bin.
Does this mean the pointer to the bin is already there so I don't have to add an entry into the PATH environment?
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to jump in.
You can see what the current PATH is set to by openning a Command Prompt window and entering SET. This displays all the environment variable settings.
I think just entering PATH will do the same.

A quick way to see if Windows can find javac.exe is to enter javac.exe in the Command Prompt window. You'll either see a response from the javac.exe program (which you'll recognize) or a response from Windows that says something about an unknown or invalid command. If it's not found, try entering the path you have found to the javac.exe file and see what you get.

Some IDE's allow you to specify the full path to the compiler as one of their setup Options or Preferences. So you could give the IDE the full path to the compiler without having to set PATH.
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too bad they gave you that advice without mentioning that 90% of installs automatically set the path. If you open a command window and run the java command you will know whether it's "not found" or already installed.

BTW, ditch that book and be wary of cutsy marketing covers. If you want a beginners book that will really teach you from the ground up and prepare you for a career, no finer book was every published than this:

http://www.artima.com/chapters/book.jsp?num=116668

Agile Java is a beginner's bookd that consolidates the core aspects of writing software. If you are serious about learning Java and actually using it professionally, Agile Java is the book to get.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rick O'Shay:
...BTW, ditch that book and be wary of cutsy marketing covers....


You'd better be careful. Them's fightin' words around these here parts. While I haven't read any of the Head First series, others here have given them high praises.

Layne
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rick O'Shay:
Too bad they gave you that advice without mentioning that 90% of installs automatically set the path....

That's a good point. (Although, I don't know where you get 90% from.)

With that said, Ginger, you should open a command line window (aka a DOS window) and type "java -version". Let us know what happens when you do this.

Layne
[ August 14, 2005: Message edited by: Layne Lund ]
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 90% comes from 90% of platforms being Windows and at least the Windows installs set the path. As far as the fighting words about Head First, they also had high praise for a book called Ship It!. I thought Flush It! was more appropriate, in my opinion of course.

I have not read the Head First series in all honesty I must reserve judgement. Better advice would be keep it and add the book I recommended.

BTW, I wonder if Ginger is related to Candy and Cookie? Perhaps not, they spell their last names with a single 'R'.
[ August 14, 2005: Message edited by: Rick O'Shay ]
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm,
Thanks for jumping in. The more opinions the better.

Ginger,
If you are on XP, you can also take a look at the control panel to see what versions of Java are installed. I've read Head First Java. It's an excellent beginners book. Of course you will want to read other books afterwards. I certainly wouldn't expect someone to become a professional program after reading just one book. This one prepares you well to read other books.
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know it needs no defending here, but I'm really enjoying Head First Java. I acknowledge that it's not the only Java book that one might need and also that it's not the book for everybody -- but what's with people (i.e. Rick O'Shay, in this case) not recognizing that different books are going to be better or worse for different people?

Oh, and these two statements are contradictory:

" in all honesty I must reserve judgement"

"BTW, ditch that book [Head First Java] and be wary of cutsy marketing covers." --(not a good example of reserving judgement)
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ginger Jarr:
Aha. The search turned up C:\Program Files\Java\jdk1.5.0_04\bin.
Does this mean the pointer to the bin is already there so I don't have to add an entry into the PATH environment?


1) Because you found the path to the bin directory does not mean that it is is your environment PATH.

2) "C:\Program Files\JavaSoft\JRE\1.3.1_03\lib\ext\QTJava.zip" is the path to your QuickTime executable.

3) You do not need to include this path in your PATH if you don't mind typing
C:\Program Files\Java\jdk1.5.0_04\bin\javac MyClass.java
each time you want to compile and
C:\Program Files\Java\jdk1.5.0_04\bin\java MyClass
each time you want to run your program.
If you put it into your PATH environment variable you can just type:
javac MyClass.java
and
java MyClass
from whereever your source file is.

4) When I installed jdk1.5.0_04, it did not automatically set the path for me.

5) The way you set the path depends on which version of Windows you are using. In other words setting the path in Windows 98 is different from setting the path in Windows 2000 or Windows XP. Which version do you have, Ginger (or are you using Linux)?
[ August 16, 2005: Message edited by: Marilyn de Queiroz ]
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff, glad to hear the Head First Java is working out for you. Those Head First guys seem to know just about everything. No wonder they published a whole series of books and the covers are cool.

BTW, when a person qualifies a remark or changes it they aren't contradicting themself, they are correcting themself. I agree with your sentiments for the most part but we have to be careful we are not imposing milquetoast rules on anybody who perhaps has more spark is more comfortable with direct opinion than wishy-washy wet dishrag prose. I know I'm careful not to do that.
 
Rick Portugal
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure how you could have an opinion on a book you have never read, but it is a fine book. "Ditch that book" is bad advice IMHO.
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have an opinion based on the cover but it's only skin deep. Even though they have a marketing campaign based around hip-hop covers, there's clearly a chance a given Head First book is acceptible. That's why I modified my remarks.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!