This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
After much ummm and arr I taken the plung to learn another language after VB (don't laugh we have to start some where ), and found that I like the look of JAVA also when I found out "Write once run any where" I thought it was too good not to learn, so any way back to my problem I bout "Head First Java" and in chapter 1 page 3 you have a small expample of an application which goes some thing like this..
How ever when i come to run this like so "java Party" i get ..
and don't know why as you may have guessed im using mac os x tiger 10.4.9. Can any one help shead some light why it wont run and why i get that message.
Welcome to the Ranch. Good idea to try learning Java.
A very common problem. At least you have Java set up and running correctly to get that error at all.
I presume that they have provided the whole application in HFJ? Somewhere in it you will find a method with the heading:-The Java virtual machine looks for this method heading (the main method) and when it finds it, starts implementation there. 1: Check that you have a main method in the example given, and also in what you have written out. 2: Look for another example (maybe on the next page) which might look like this:-3: Check that your spelling of "public static void main(String args)" is correct; there are only very slight variations permissible.
If that doesn't work, come back and ask again. [ April 11, 2007: Message edited by: Campbell Ritchie ]
Joined: Apr 11, 2007
Thanks for the reply, I've checked and double checked that theres no main() method in this example if i could scan this exmple in i would then provide you with a link to it but i cannot , the example called MyFirstApp.java does how ever have a main() method , I've even tryed to enter a main() method into that example and still it refueses to run.., then after a quick thought here is the new code which seems to work though mac os x wont show the window lol and i only know its working because of the way mac os x apps work menu wise .
Joined: Oct 13, 2005
Have you been through the book looking for related examples? There may be an example on another page which provides the requisite main method. Difficult to tell what you are doing in the example which will run and won't compile, but it is generally a bad idea to put all that amount of code into the main method.
I still think they have provided a class with a main method to set off this application and you haven't found it yet. Go through the whole of chapter 1 until you find it. I don't have a copy of HFJ; anybody with a copy know whether there is another page number we ought to recommend?