Geeks With Blogs

Michael Crump Microsoft MVP, INETA Community Champion and XAML Advocate.

imageIf you're walking down the right path and you're willing to keep walking, eventually you'll make progress." – Barack Obama

In my quest to become a better programmer, I’ve decided to start the process of learning Java. I will be primary using the Eclipse Language IDE. I will not bore you with the history just what is needed for a .NET developer to get up and running. I will provide links, screenshots and a few brief code tutorials.

Links to documentation.

The Official Eclipse FAQ’s

Links to binaries.

Eclipse IDE for Java EE Developers the Galileo Package (based on Eclipse 3.5 SR2) 
Sun Developer Network – Java Eclipse officially recommends Java version 5 (also known as 1.5), although many Eclipse users use the newer version 6 (1.6).

That's it, nothing more is required except to compile and run java.


Unzip the Eclipse IDE for Java EE Developers and double click the file named Eclipse.exe. You will probably want to create a link for it on your desktop. Once, it’s installed and launched you will have to select a workspace. Just accept the defaults and you will see the following:


Lets go ahead and write a simple program.

To write a "Hello World" program follow these steps:

  1. Start Eclipse.
  2. Create a new Java Project:
    1. File->New->Project.
    2. Select "Java" in the category list.
    3. Select "Java Project" in the project list. Click "Next".
    4. Enter a project name into the Project name field, for example, "HW Project".
    5. Click "Finish" Allow it to open the Java perspective
  3. Create a new Java class:
    1. Click the "Create a Java Class" button in the toolbar. (This is the icon below "Run" and "Window" with a tooltip that says "New Java Class.")
    2. Enter "HW" into the Name field.
    3. Click the checkbox indicating that you would like Eclipse to create a "public static void main(String[] args)" method.
    4. Click "Finish".
  4. A Java editor for will open. In the main method enter the following line.
         System.out.println("This is my first java program and btw Hello World");
  5. Save using ctrl-s. This automatically compiles
  6. Click the "Run" button in the toolbar (looks like a VCR play button).
  7. You will be prompted to create a Launch configuration. Select "Java Application" and click "New".
  8. Click "Run" to run the Hello World program. The console will open and display "This is my first java program and btw Hello World".

You now have your first java program, lets go ahead and make an applet. Since you already have the open, click inside the window and remove all code. Now copy/paste the following code snippet.

Java Code Snippet for an applet.

   1: import java.applet.Applet;
   2: import java.awt.Graphics;
   3: import java.awt.Color;
   5: @SuppressWarnings("serial")
   6: public class HelloWorld extends Applet{
   8:   String text = "I'm a simple applet";
  10:   public void init() {
  11:     text = "I'm a simple applet";
  12:     setBackground(Color.GREEN);
  13:   }
  15:   public void start() {
  16:         System.out.println("starting...");
  17:   }
  19:   public void stop() {
  20:         System.out.println("stopping...");
  21:   }
  23:   public void destroy() {
  24:         System.out.println("preparing to unload...");
  25:   }
  27:    public void paint(Graphics g){
  28:     System.out.println("Paint");
  29:     g.setColor(;
  30:     g.drawRect(0, 0,
  31:            getSize().width -1,
  32:            getSize().height -1);
  33:     g.setColor(;
  34:     g.drawString(text, 15, 25);
  35:    }
  36: }

The Eclipse IDE should look like


Click "Run" to run the Hello World applet. Now, lets test our new java applet. So, navigate over to your workspace for example:

“C:\Users\mbcrump\workspace\HW Project\bin” and you should see 2 files.


Create a HTML page with the following code:

   1: <HTML>
   2: <BODY>
   3: <APPLET CODE=HW.class WIDTH=200 HEIGHT=100>
   4: </APPLET>
   5: </BODY>
   6: </HTML>

Open, the HTML page in Firefox or IE and you will see your applet running. 


I hope this brief look at the Eclipse IDE helps someone get acquainted with Java Development. Even if your full time gig is with .NET, it will not hurt to have another language in your tool belt.

As always, I welcome any suggestions or comments.

Posted on Wednesday, May 19, 2010 8:38 AM General Software | Back to top

Copyright © mbcrump | Powered by: