This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have just finished "Head First HTML with CSS & XHTML", my first venture into building a Website. I have now purchased "Head First Java 2nd Edition" and I have just basically opened the book. My query is.. After entering code into my text editor I beleive I have to compile the source code by running 'javac' but how and where do I run it? I'm using an Intel Mac Pro with the Leopard O/S. I expect yo will think this is easy, but I don't have a clue where to start and would very much appreciate your advice
thanks in advance, Denis
Pauline McNamara
Sheriff
Joined: Jan 19, 2001
Posts: 4011
posted
0
Hey Denis, welcome to Javaranch. And to Macs. And to java, for that matter.
I have to compile the source code by running 'javac' but how and where do I run it?
You use the application called Terminal that comes with your mac. A quick search of this forum with "compile" gets you a bunch of discussions about starting out on a mac. Here's one to start chewing on:
Once you're at the terminal command line, everything will work pretty much the same as with any other Unix-based system. So tutorials written for any Unix should be helpful. Avoid tutorials written for Windows, which as we know has its own proprietary rules which don't apply to other OS's. [ December 31, 2007: Message edited by: Bear Bibeault ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Denis Williams
Greenhorn
Joined: Dec 30, 2007
Posts: 19
posted
0
Hello Pauline, Bear and Marc, and a Happy New Year to you all. Thank you for your Guidance. As a result I have written, compiled and successfully run the "Class HelloWorld" (my first, hopefully not my last successful java code). I also realised in doing so that the code I was originally trying to compile from the book "Head First Java page 3 may not be complete. I did manage to compile it but I could not get it to run! It talks about starting Java Virtual Machine with Party.class but when I double click it nothing happens, and if I type it in the terminal i.e. java Party it displays the following:-
Originally posted by Denis Williams: ... I can only presume it might not be complete or I need this JVM and haven't got it on my Mac OSX? ...
The example on page 3 of HFJ is just a sketch of how the pieces fit together -- it won't run as shown. See the note at the bottom of the page...
...you'll be writing real code in a moment, but for now, we just want you to get a feel for how it all fits together.
The JVM on your Mac should be perfect for this book (and it's an excellent book to start with, by the way!).
Denis Williams
Greenhorn
Joined: Dec 30, 2007
Posts: 19
posted
0
Thank you Marc. the code on page 3 had compiled OK and because of that fact I had been unsure if indeed it was supposed to run. Regarding the JVM in the Mac OSX Leopard, forgive me if i'm asking a stupid question but how does one access the JVM? as I can't seem to locate it!
What do you mean by "locate it"? Using the java command at the command line will invoke it.
Denis Williams
Greenhorn
Joined: Dec 30, 2007
Posts: 19
posted
0
Thank you Bear Bibeault, I could not find anything in the Java folder indicating that JVM existed and I was under the misapprehension that I had to start something, like a programme hence I was looking for it! As I stated I am completely new to Java and was not aware that jvm started on it's own.
Regards Denis
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.