I have been doing a bunch of Struts and REST development in Eclipse for which there are good wizards to get started, but it was suprizingly difficult figure out how to build just a simple hello world java project.
With the help of Nathan, I can now do the basic java project:
First, select the new button just below File and open a new Java Project

A New Java Project window will open: enter the name of the project then click Finish

You should now see your project listed in the Package Explorer. Expand the project.


Under the project you will see the project’s package (src) and the library it is referencing. You now want to add a class to the project where you can write your program. So right click the package (src), select new -> class.

The New Java Class window opens. Notice the Source Folder. Type the name of the new class and ensure “public static void main(String[] args)” is selected. Click finish to create the class.

Because we selected the option to create the main, the IDE automatically inserts its declaration into the code. Now we can begin to write our basic program right away.

Replace the comment with this text:
String printStr = "This is your conscience speaking..."; System.out.println(printStr);
In the Package Explorer, right click the class and select Run As to run the program. If a message box appears, select yes to save the project. You will see the text printed to the screen.

No comments:
Post a Comment