HelloWorld in Eclipse

7 08 2007
  1. Downloaded the JRE 1.6.0_02 from the sun site (bin version) and extracted it to /opt/jdk
  2. Removed the Ubuntu’s version of JDK. I think the Ubuntu version of JDK (1.6.) was ok, but the java common binary was incorrect (1.0.4 something). Could n’t find what package provides this. For now, set PATH to refer to /opt/jdk before /usr/bin to solve this.
  3. Download and installed whole bunch of eclipse stuff from Ubuntu repository.
  4. Open Eclipse … wait for few minutes
  5. Add /opt/jdk in Eclipse’s JDK. Under Window->Preferences->Java->Installed JREs, click Add and select /opt/jdk
  6. Select File->New->Project->Java->Java Project.(check the JDE version is 1.6.0_02)
  7. Enter Project name and press Next
  8. Enter Finish
  9. Select File->New->Class
  10. Enter Name (Class name) : HelloJavaClass
  11. Eclipse generate the template for you: public class HelloJavaWorld {
    }
  12. Enter your code now: public class HelloJavaWorld {
    public static void main(String[] args) {
    System.out.println(”Hello java World!”);
    }
    }
  13. Select Run->Run As->Java Application
  14. Wait… pray and the console displays ‘Hello java World!”

Now, THATs simple programming.


Actions

Information

Leave a comment