Installing the SDK
First you have to download and install the J2SE/JDK from java.sun.com:
Download The Java Software Developer Kit (SDK)
Installing Textpad
After you have the JDK installed, you can download and install the free and easy-to-use Textpad:
Download Textpad
Using Textpad
|
Step1:

You can use many different applications to handle your Java code but in this tutorial we are gong to use Textpad. Start by executing Textpad..
Type/paste in your java code and save your new java file to your wanted folder, or click the file menu and open your already existing java code file.
IMPORTANT! The java class name must be EXACTLY the same as the name of the java file(as shown in the picture above). The only difference is that the file name must be followed by the ".java" file extension.”
|
Step2:

Now that you have saved your java file to your wanted folder it’s time to compile the code (translate from source code to machine code). You can do this by selecting Tools > Compile Java from the menu like in the picture above.
(Check the known Textpad problems belov if you were not able to compile the code)
|
Step3:

Press Command Results (like in the picture above) to check if we got errors during compilation.
|
Step4:

Select the java file we want to run.
|
Step5:

To execute the file we can select Tools > Run Java Application
|
Step6:

If all went as planned you should see the text printed in the console window.
|
Preferences:

If you are having problems you should check your java setup:
Click Configure -> Preferences and expand the Tools menu
|
Preferences:

|
Preferences:

|
Preferences:

Expand Tools menu and see if you can find the name javac.
If not, you can select Tools and press the Add button select Program... and browse for the javac.exe file. It shoud be in your jdk/bin/ folder (this will create the javac command).
We can use the javac command to compile our java code.
|
Preferences:

Expand Tools menu and see if you can find the name java.
If not, you can select Tools and press the Add button select Program... and browse for the java.exe file. It shoud be in your jdk/bin/ folder (this will create the java command).
We can use the javac command to run our java program.
|
You may also have check your environment variables.
CLASSPATH, JAVA_HOME and PATH.
|