Introduction: Setup Java for Beginners

This instructable is for staging your computer to be able to write your own code compile and run java without using the NetBeans program and its all free software.

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform . The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file ) that can run on any Java Virtual Machine (JVM) regardless of computer architecture . Thanks Wiki


Step 1: Download the Software

(Only Windows) You will need to install, "Java SDK"(Java source code) and "Crimson Editor"(Color Text Editor). Links below.

Java SDK
 Download the latest release of the Java SDK or JDK (means the same thing) from http://java.sun.com. You will get an install program named something like j2sdk-1_4_1_05-windows-i586.exe, run this program and it will install the Java Software Developers kit. (make sure the file is called j2sdk####, and not j2jre#### which is the Java Runtime Environment).

Crimson Editor
Download the latest release of crimson editor from http://www.crimsoneditor.com. You will get an install program named something like cedt.exe, run this program and it will install crimson editor on your system.

Step 2: Installing Java and Crimson Editor

Java
Now, after downloading Java SDK. Click on the exe that you have downloaded to start the install process. You should just click next when prompted or until it has finished installing. and remember where you are placing the install files such as the to the default location, "C:\SunSDK"

When you create the admin account name and password please note it down or something will not work for you later in your java programming experience.

Crimson Editor
After Crimson Editor download has finished.Click on the exe that you have downloaded to start the install process. You should just click next when prompted or until it has finished installing.

Step 3: Configure Crimson Editor to Compile and Run Java Programs

Set up “compile java” menu option

Start Crimson editor (you may get an error the first time you start it, ignore the error) Click on the tools menu, then conf. user tools (or something close to that) You should see a dialog with a list of items that say “empty” select the first empty item in the list. For menu text enter “compile java”  where it says command enter the path your javac.exe is found. That will be where you installed the java JDK\bin\ followed by javac.exe (example: C:\Sun\SDK\jdk\bin\javac.exe). Where it says argument click the black arrow to the right and select File Name, this should enter $(FileName) for you in the text box. Where it says initial directory click the black arrow to the right and select File Directory which should enter $(FileDir) in the text box for you. At the bottom make sure the checkbox that says “capture output” is checked. This preserves any error messages generated by the Java compiler. If you click OK and then go to the tools menu again, you should now see an option for compiling java programs.

 Set up “run java” menu option

Click on the tools menu, then conf. user tools  You should see a dialog with a list of items that say “empty” select the first empty item in the list. For menu text enter “run java” where it says command enter the path you found above followed by java.exe (example: C:\Sun\SDK\jdk\bin\java.exe). Where it says argument click the black arrow to the right and select File Title, this should enter $(FileTitle) for you in the text box. Where it says initial directory click the black arrow to the right and select File Directory which should enter $(FileDir) in the text box for you. At the bottom make sure the checkbox that says “capture output” is NOT checked. Also, make sure the checkbox that says “close on exit” is NOT checked. If you click OK and then go to the tools menu again, you should now see an option for running java programs.

Step 4: Testing Java

Java 101 : Hello World
1 Save the file as what your class is called but with a .java so something like this, "myfirstjavaprog.java.
2. Go to compile that we just created.
3 now go to RunNOW that we created and look at the output. and you should be done.


CODE:
class myfirstjavaprog

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

Step 5: Learn Java

You now have setup java to create anything you want in the world. and you created your first program what next anything. programing is an Art form like any other media all you have to be is creative. let me know if you find anything wrong with my setup.

Step 6: Set Up Your Environment. (optional)

If you are running Windows XP or higher skip these steps please. :)

Windows 98 Find the location of your java/bin directory

If you click on the Start menu, then Find, then Files or Folders, and type javac.exe where it says “Named:” This will locate any file on your computer named javac.exe, once the file is located, to the left you should see the name of the folder where your Java compiler, and Java runtime environment is contained. It should be something like c:\j2sdk1.4.1\bin

 Tell DOS how to find your Java SDK

Run notepad, and then open the file “c:\autoexec.bat” if this file doesn’t already exist, create it.

Make a new line at the end of this file and add

SET CLASSPATH=%CLASSPATH%;.

Add another line and type

SET PATH=%PATH%;c:\j2sdk1.4.1\bin

But replace c:\j2sdk1.4.1\bin with the path to your java/bin directory that we found in the previous step.

 Tell DOS to execute autoexec.bat whenever you start the command prompt

Start a command prompt, either by clicking on it’s icon in the Start menu, or by clicking the Start menu, then the Run… item and then typing “command” and pressing enter. If your entire screen turns black and you only see text, this means you are in full-screen mode, just press alt-enter at the same time and you will be back in windows mode. While in windows mode you should see an icon at the top of your DOS window that looks like a hand pointing at a piece of paper. Click on this icon and a dialog will appear with several places to enter information. Where it says batch file type c:\autoexec.bat Then click on the tab that says “memory” and set the initial environment to a high value like 4096.