Java

From CISE IT WIKI
Jump to: navigation, search

CISE maintains up-to-date Java installations using APT on Ubuntu systems and Oracle's Java Update on Windows systems. Typically, the latest stable and secure version of Java will be installed.

Which Version of Java is Installed?

To determine which version of Java is installed, execute:

   % java -version
   % java version "1.6.0_24"

Java Test Program

You can create, compile and test a java program by doing the following:

On Ubuntu:

  1. Download the source code for the test program by executing the command: % wget http://cise.ufl.edu/static/HelloWorld.java
  2. Compile the code for the test program by executing: % javac HelloWorld.java
  3. Run the test program by executing: % java HelloWorld

On Windows:

  1. Download the source code for the test program from: http://cise.ufl.edu/static/HelloWorld.java
  2. Save it as HelloWorld.java
  3. Open the Windows Command Line and change directories to where the "HelloWorld.java" file was saved
  4. Compile the code for the test program by executing: C:\Users\user> javac HelloWorld.java
  5. Run the test program by executing: C:\Users\user> java HelloWorld

Trouble?

If you are having trouble compiling or running your Java program on a CISE machine or terminal server(Storm or Thunder), try running the example programn above. If the example program works then your Java program is asking for too many resources.

Note: Asking for too many resources may cause the following error: Error occurred during initialization of VM - java.lang.OutOfMemoryError: unable to create new native thread