It's not a secret anymore!*
The moose likes Beginning Java and the fly likes A Rather Sad Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A Rather Sad Problem" Watch "A Rather Sad Problem" New topic
Author

A Rather Sad Problem

Bryan Wulzen
Greenhorn

Joined: Oct 24, 2008
Posts: 2
After deciding to learn java, and purchasing a book to do so, I'm having some difficulties starting out. I'm on a Mac, version 10.4.11, and according to every source I've looked at, the JDK should be packaged into my computer somewhere. I've spent a solid half hour diving through files to try and find this elusive program, and have used spotlight for every combination of 'java development kit' possible with no luck.

So, could someone help me out? Where is the JDK found? Be as condescending as you like!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61306
    
  66

Bring up a Terminal window and type the "java -version" command. What happens?

If it prints something like:then Java is installed and you are all set.

If not, and you get a "command not found" error, it's not.

I've been on Leopard (10.5) for some time now, so I don't recall if Tiger needs the Developers Tools to be installed in order to get Java.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bryan Wulzen
Greenhorn

Joined: Oct 24, 2008
Posts: 2
Yay, my first step in the right direction! I get nearly the same message as you, with slightly different numbers (naturally). However, I'm not entirely clear here -- where exactly do I type in code? Thanks for your help and patience with me.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
Welcome to JavaRanch

You use the same terminal window to execute Java code.

Navigate somewhere with the commands (probably "cd" and name of directory).
Use the commands to create a folder/directory for your Java Work. Maybe you'll call it Java, or JavaWork, or similar. Maybe "mkdir Java".
Use "cd" to go into that directory.
Use a text editor to save a .java file in that directory. If it's a HelloWorld program, then you would save the file "HelloWorld.java"
Compile it to bytecode with the command "javac HelloWorld.java"
Look at the long list of errors, and see if you can understand any of them.
When you stop getting any errors, get the java application to interpret the bytecode with the command "java HelloWorld".
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
By the way, if you go to the Java Tutorials you find a letter-by-letter guide to a HelloWorld application, and it has a list of common errors. If you try "javac Foo.java" and nothing happens, assume the compilation has be successful.
 
jQuery in Action, 2nd edition
 
subject: A Rather Sad Problem