learningjava icon indicating copy to clipboard operation
learningjava copied to clipboard

no main() in HelloJava. files

Open codeshift8 opened this issue 12 years ago • 5 comments

Hello Pat, I hope you will see this at some point. In all the HelloJavax.java files there's no main() and as such I've not been able to get them to compile and nothing in the book is helping. Could you review and correct please?

codeshift8 avatar Jul 05 '13 18:07 codeshift8

Hi,

Each HelloJava.java example file should have a main() method. e.g. HelloJava4.java has the main starting on line 7. You can view it on github here:

https://github.com/patniemeyer/learningjava/blob/master/examples/ch02/HelloJava4.java

Could you tell me what you see exactly in your file and where you got it? Did you download the zip or grab it from github?

Pat

On Jul 5, 2013, at 1:25 PM, codeshift8 [email protected] wrote:

Hello Pat, I hope you will see this at some point. In all the HelloJavax.java files there's no main() and as such I've not been able to get them to compile and nothing in the book is helping. Could you review and correct please?

— Reply to this email directly or view it on GitHub.

patniemeyer avatar Jul 05 '13 19:07 patniemeyer

Might I suggest you run through the latest edition of the book with your source and a clean Eclipse install.

ChrisWeiss avatar Feb 21 '14 19:02 ChrisWeiss

I got it to run by creating a new Package (Right-click over 'learningjava-master' > New > Package) and drag&drop the exercise to it. ... but I don't know why this worked and what's the fix for all the other chapter exercises (I'm a complete Java newbie).

rossola avatar Mar 06 '14 17:03 rossola

... I think I got it, the following first line is missing in 'HelloJava.java'. package examples.ch02;

rossola avatar Mar 06 '14 17:03 rossola

I was able to resolve the problem the same way rossola did. It seems that all of my files have the same problem as well. I went through HelloJava.java, HelloJava2.java, and HelloJava4.java.

I downloaded from: https://github.com/patniemeyer/learningjava Using the Download Zip button. I'm using the fourth edition of the book.

Is there a way to get my original source files to work correctly?

Thanks!

ghost avatar Aug 01 '15 18:08 ghost