• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

A total newbie needing advice

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

https://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
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's another thread about compiling and running your first program. Let us know how this works for you.
 
Denis Williams
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "locate it"? Using the java command at the command line will invoke it.
 
Denis Williams
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic