aspose file tools*
The moose likes Mac OS and the fly likes A total newbie needing advice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "A total newbie needing advice" Watch "A total newbie needing advice" New topic
Author

A total newbie needing advice

Denis Williams
Greenhorn

Joined: Dec 30, 2007
Posts: 19
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: 4012
    
    6
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:

http://www.coderanch.com/t/111423/Mac/Getting-started-Java-MacOS

It's a bit dated, but the basics haven't changed.


Happy coding!
And Happy New Year
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Here's another thread about compiling and running your first program. Let us know how this works for you.


"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
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:-

Exception in the thread "main" java.lang.NoSuchMethodError: main

I can only presume it might not be complete or I need this JVM and haven't got it on my Mac OSX?

Regards Denis. P.S Sorry for delay in replying got tied up with New Year celebrations.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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
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!

Regards Denis
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

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
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://aspose.com/file-tools
 
subject: A total newbie needing advice
 
Similar Threads
SCWCD question
Design visualisation
scwcd
Is Kathy sierra sufficient to clear SCJP?
Head First EJB - Help