Solved

Before I can write a Java program

Posted on 2004-10-30
265 Views
Last Modified: 2013-11-23
Hi Experts,

I knew little Java a few years ago and forgot all of them now.
However, I need to write a (very simple) Java program at the moment!
Can you suggest any software for editing, compiling and running Java codes? Where to download and how to install for my WindowsXP?

Thank you in advance.
0
Question by:daveask
    21 Comments
     
    LVL 2

    Accepted Solution

    by:
    Hello, daveask.

    For very simple program I would use any text editor with tokens colouring. :-)

    Also you can look at
    http://www.eclipse.org/


    Regards.
    0
     
    LVL 13

    Expert Comment

    by:petmagdy
    offcourse Eclipse 3.0.1 works on XP and it is free!

    http://www.eclipse.org/downloads/index.php

    also Netbeans is excellent and free:

    http://www.netbeans.org/
    0
     
    LVL 15

    Assisted Solution

    by:JakobA
    I would recommend notepad for writing and editig the .java files

    along with the basic java development package from sun (contains compiler, virtual machine, etc)
    http://java.sun.com/j2se/1.4.2/download.html      "J2SE v 1.4.2_06  SDK"

    If you are going to write many such programs it might be worthwhile to learn the rules of Jbuilder or Forte or some other develpers package; but it is not worth it if it is just one little program.

    regards JakobA
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    read this thread and decide yourself to use the  IDE

    http:Q_21048347.html
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    0
     

    Author Comment

    by:daveask
    Thanks a lot for your helps!

    Only one file I need to dowload and can do compiling and running my Java code?
    http://java.sun.com/j2se/1.4.2/download.html      "J2SE v 1.4.2_06  SDK"

    I am confused what I should download here:
    http://www.eclipse.org/downloads/index.php
    I saw a few files.....
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    0
     
    LVL 13

    Expert Comment

    by:petmagdy
    davesk, any all of them are mirror to the same
    0
     

    Author Comment

    by:daveask
    sudhakar_koundinya,

    So, I need to download eclipse-SDK-3.0.1-win32.zip and J2SE v 1.4.2_06  SDK?
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    hmmm download J2SE v 1.4.2_06  SDK  that is the better choice

    >>So, I need to download eclipse-SDK-3.0.1-win32.zip and J2SE v 1.4.2_06  SDK?

    So, You must
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    Netbeans u can get along with J2SE
    http://java.sun.com/j2se/1.4.2/download-netbeans.html
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    I am using Netbeans after discussed at
    http:Q_21048347.html
    0
     

    Author Comment

    by:daveask
    OK, I installed J2SE v 1.4.2_06  SDK. Do I need to set something before I run my code?
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    I don't know which IDE you are preferring.

    If  you have installed Eclipse/Net Beans IDE. You don't need any further software


    OK,

    If youd did not installed Eclipse like IDE then write a program in Notepad

    and you need to compile them at command prmpt.

    Regards
    Sudhakar
    0
     

    Author Comment

    by:daveask
    sudhakar_koundinya,

    Thank you.
    No IDE yet! I cannot wait it and want to have a try now. Can you tell me what command I need to compile and then run a file: and what extention I shold give this file?
    0
     
    LVL 14

    Assisted Solution

    by:sudhakar_koundinya
    1. Your first program -> Write  below one in Notepad

    public class HelloWorld
    {
         public static void main(String s[])
         {
                 System.out.println("Hello World!!! ");
         }
    }

    2. Now save this Program as HelloWorld.java
     
    (Take care that class name and File name should be same.)

    I am assuming You saved the program   in c:\ and Installed the SDK in c:\J2SE1.4

    3. Now set the path to Java Installed diractory from command prompt

    set path=%path%;c:\J2SE1.4\bin

    4. Now set the classpath to Your Installed SDK from the command prompt

    set classpath=%classpath%;c:\J2SE1.4\jre\lib\rt.jar;c:\J2SE1.4\jre\lib\

    5. Now compile your Java file from command prompt
    (Assuming you are c:\ and file is saved as c:\HelloWorld.java)

    javac HelloWorld.java

    6. Now Execute the program from command prompt

    java HelloWorld

    Take care that class name and File Name should be same. And Java is case Sensitive Language.

    That's it

    Welcome to Java World and Happy Programming

    Regards
    Sudhakar



    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    0
     

    Author Comment

    by:daveask
    Thanks a lot!
    I have done the 'set path' and 'set classpath', I found MyClass.class after javac, but when do java, I got
    Exception in thread "main" Java.lang.NoClassDefFoundError: c:\...MyClass

    MyClass.java is my program, do you think I did something wrong in it?
    0
     

    Author Comment

    by:daveask
    OK, now it is working, I even don't know why.......

    Thanks a lot for all your helps.
    0
     
    LVL 14

    Expert Comment

    by:sudhakar_koundinya
    :)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now