Tuesday, August 31, 2010

(Oracle) Sun Java SE Downloads


Corporate Link:  http://www.oracle.com/technetwork/java/javase/downloads/index.html


Open Source Link:   https://jdk.dev.java.net/

I think the above link looks different depending on which OS (Linux/Windows) I am connecting with.
 

Friday, August 27, 2010

Hello World

This was a pain in the neck and took several tries.  The problem lies in the new windows installer, JDK 6 Update 21, not setup the PATH or CLASS environment variables.

To see what the current path looks like:

set PATH

To set the path:

set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_21\bin

To set the class path:

set CLASSPATH=%CLASSPATH%;.

To verify that you have the path correct type:

javac -version

Now I am ready to build.

To open a text window:

notepad Hello.java

Enter the following text into the text editor

class Hello
{
public static void main (String args[])
{
System.out.println("Hello Stan!  I am a java application.");
}
}

Compile with:

javac Hello.java

Run with:

java Hello

Make sure to get the caps right.  'java Hello' is not the same as 'java hello'.

If you get an error about not finding the class definition (NoClassDefFoundError), check and make sure the class path is set.

If you get this error with the message 'wrong name:' than make sure the name at the command line matches the capitalization in the code.