Saturday 18 February 2012

WORKING IN ECLIPSE IDE

WORKING IN ECLIPSE IDE
======================
    So far , I did all my work in command prompt ( shell). I find it easier to do and understand.
   But, I am told by my friends and seniors that it is absolutely necessary to know how to use Eclipse, in any software company job.
  
    So, I began my experiments with Eclipse a few days back. There are many names by which Eclipse is known, such as Indigo, Europa, Ganymede, Helios ,Galileo, Calisto etc. I got confused. I made a google search for ‘eclipse versions and code names’.   Wikipedia gives the following information.   I think , this may be useful to students like me.

      Calisto              June 2006            3.2

      Europa             June 2007            3.3

      Ganymede       June 2008            3.4

      Galileo              June 2009           3.5

      Helios               June 2010           3.6

      Indigo               June 2011           3.7
      

    As I found many references in articles to Ganymede, I downloaded  that software by typting
Eclipse Ganymede Software  in  Google 
 I got the site as

     There are two versions.

a)           Eclipse IDE for Java Developers
b)           Eclipse IDE for JEE  Developers.

As my work is mostly in J2EE, I downloaded the EE version. It took about 30 minutes.
=============================================
The latest version however is Indigo ( 3.7).
So, I will illustrate with Indigo.
Indigo also is about 200 mb .


RUNNING    A SIMPLE   CONSOLE  PROGRAM
 IN
ECLIPSE (INDIGO) 

Initially  You  will get a  welcome  screen. Close  It.

choose   file ->new

we choose ‘other’ and click

we get a lot of options.

I chose ‘java project’ directly .
and clicked ‘next’



Then, I chose ‘class’

Then I got a  dialog  box asking ‘package name’, ‘class name’, etc . For this project  I didn’t used   package. so I gave  the  ‘class name’  only as 'demo'.
There  is  a question  “which method  stubs  would  you  like  to  create”

I chose  the  first option (ie)
 ‘public  static void main(String[]  args)’
then  I  clicked ‘finish’. So that  I got  the following  page (in which I found  automatically  created  demo class  with  main method)
Then  I  included my  code.
Then I  saved  that  program

Then  I  right clicked over  that  program. So that  I  got  the list
Then  I chose ‘Run  as’  from  the  List
So  I got  another  List, From that list  I selected  “java  Application”
The  program  got  run and  I  got  the result in console  screen.
( if we close the two windows in the right side of the screen,
we get just three windows.
One in left, another in top right and the third in bottom right.

The left window is the project explorer.
The top-right is edit window.
The bottom-right is the output window ( console).
When we run the program, we get ‘hello’ in the output window ( console).
Actually, console is better name than ‘output window’ because, we can give input in that window.
 --------------------------------------------

   HOW   TO RUN A SERVLET
(USING PACKAGE AND HELPER CLASS

I   AM USING  ECLIPSE   GANEYMEDE  J2EE  VERSION

I  HAVE   CONNECTED  TO  TOMCAT5.

File->new->Dynamic web project
Give name as rms. ( my name)
Then  Right  Click on your  project  name which is in top  left of the screen. Then You will get the list. I chose ‘package’.
2.           so, I got  the dialog.
    give  name  to that   package.
3. Then  creating  a  hellobean.java   in  mypack
i.             right  click  on the “mypack”  package
ii.        go  to  new->class
Then  type  your  hellobean  class  code.

4. Then  create  the helloservlet  in  mypack .

5. Then   give   name to  helloservlet

6. Then  type  the  helloservlet.java  code

7. Then  create  the helloservlet.htm    file

   i.             right  click  on  your  project  folder and  choose  items 

  8. then  give name  to  html   file

9.Type  the  html   code

10.                    then  save  all your  files  and  then  run  the  html  file  
                   
     i .  right  click  on  the above html file and choose  Run asàRun On Server

You  will get the input  page. Give  input and click the ‘submit’  button.
Then  you  will get the following output.


In the coming lessons, I will show how I ran the other types of programs like AWT Frame, Swing, TCP client-server, UDP client-server, RMI, RMI-IIOP, IDL, JSP, Hibernate console & frame,
Struts1.1 , etc.

I  have given  the  full lesson with  screen shots in  my website