aspose file tools*
The moose likes Beginning Java and the fly likes java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java application" Watch "java application" New topic
Author

java application

david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
Hi,
I am new to java and I am trying to learn java using the head first java II Edition. I am using Eclispse. For certain practise programs when I want to run it as a java application, that option is not coming. Only option that comes is run in server. Please help me understand why is it so. The program which I am not able to run as java application is posted below.

[ October 26, 2008: Message edited by: david john ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

As Campbell Ritchie said in your other thread, please check your private messages.

And also please Use Code Tags.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
Done sir... i will take care of the [code tags] from the next posts... thanks for helping.... please help me understand the issue posted
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

You can use the edit button to modify your post yourself.

The problem is, your main method is not static. It should really be public static void; if either public or static is missing the JVM cannot find it.

That will give you some more (compiler) problems, but those can be solved by checking your class setup. Making all your inner classes static will already help a lot.
david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
Thanks Rob... got the point!
david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
I was able to run the program after making the main method and the class containing the main method as static. Now I am able to run the program as java application. I again checked in the Head First Second Edition book. there they have only mentioned the method as static and not the class as static. Is it a print error or something else.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

I don't have that book, but did they have the classes inside that "game" class? I doubt it.
david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
No it was not under game class, in the book 3 sepearate class are mentioned. I clubbed them under one class. In the book it was not under one class. I did not understand how will it make difference. Sorry for such silly questions but i am still in learning stage.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38398
    
  23
You ought to have lots of classes; each class should represent one sort of thing. Don't try squashing them all into a single class.
david john
Greenhorn

Joined: Oct 16, 2008
Posts: 16
Thank you.... Guess I m still not getting the concept of static.... I will try to learn that first... :roll:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java application