| Author |
probably a knucklehead question but...
|
Patrick Burdine
Greenhorn
Joined: Nov 04, 2010
Posts: 2
|
|
Like many of the other beginners here, I am learning this through the Head First book. I am using a macbook Pro running OSX 10.6.5
when I run java -version I get 1.6.0_22 (from anywhere which makes me think it is in the path)
I write the basic code out in vi and then save it as a .java file (BeerSong.java for instance).
I can compile it with javac BeerSong.java which creates the class. But them I am not sure what to do. I get errors when I try and run %java BeerSong.java
The HF book shows that I should be typing %java but when I try the %java I get a message -bash: fg: %java: no such job.
Sorry for the basic question but I am pretty new to this, teaching myself through these books (started programming with HF Programming and getting into Python - thanks!)
Patrick
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
I'm not into Mac, but I'm not sure you need that "%". Try again without it and correct it to "java BeerSong", not "java BeerSong.java". You may have to make your class in the classpath. An easy way to do it is to go to the top package where your class is, and type "java -cp . BeerSong".
I'm not sure because I don7t have the book, but I guess that the "%" is just a symbol shown at the command prompt of the Unix terminal.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Patrick Burdine
Greenhorn
Joined: Nov 04, 2010
Posts: 2
|
|
AH, that got it, thanks! I am used to having to add an extension when I run the file. I knew it was an easy one. Thanks!
The % thing I a bit odd, I kind of thought that too, but even in the plain text they show it. Ah well. Thanks again!
Patrick
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16687
|
|
Patrick Burdine wrote:
The % thing I a bit odd, I kind of thought that too, but even in the plain text they show it. Ah well. Thanks again!
Of course, my fellow old-timers know that, on early versions of unix, using the original version of the bourne shell, and not setting a command prompt, and the user is not the super user, then the default prompt is "%".
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
|
|
|
Got it sorted out : And welcome to JavaRanch.
|
 |
 |
|
|
subject: probably a knucklehead question but...
|
|
|