Friday, May 15, 2009

Writing the First Hello World Program Using The Eclipse.

Hi all,

It has been quite long since i posted anything new in my blog.Right Now iam working in a java environment where everything is new to me as i have been working on asp.net platform for an year,doing both testing and development.As iam leaned towards development i started learning java.Started off with creating a project in Eclipse which was quite simple,so i wanted to share the same with u all as it wud be useful to all those beginners like me who spent a lot of time in searching for these kind of stuff.So let's start learning!!

(1)First,install the latest version of eclipse on your computer from any of the trusted sites.
(2)Then run the eclipse which would be for the first time :)
(3)Go to File->New->project,then select a wizard window appears,in that select java project and click next(sometimes u can directly find java project in the New Tab).
(4)In create a java project window give the project name and click finish.Now u have a new project created which is shown in the package explorer.
(5)Next step is to create a package where we need to keep all the source files related to the project.Before that right click on the project name and create a new folder named src by using the New option.
(6)Then Click on the New Java Package icon present in the tool bar as shown.
(7)In the New Java Package window that appears give the package name and click Finish.
(8)Last step is to create a class file where we i need to write the code.That can be done by clicking on the New Java Class icon present in the tool bar as shown.
(9)In the New Java Class window that appears give the relevant name and check the public static void main check box as shown and click Finish.

That's it Guys!!! U are now ready with the class file which appears in the workspace where u can write ur code and execute it.

Here i wrote a simple program and executed it to console.

To Run your Java project. Right click the 'TutorialClass.java' file in the Package Explorer window, then click Run As > Java Application.Output will appear in the console

Done!!U wrote ur first java application and displayed it to console.Isn't it easy and cool...
Happy Coding:)
Hope It helps.......





No comments: