-->
Java - Using Java on Unix (Including 1.5)

Java - Using Java on Unix (Including 1.5)


Compiling Java on Unix

  1. Open a Unix Session
  2. Go to the folder where you code is.
  3. Type javac filename.java
  4. Type java filename (without the extension) to run the compiled code


    fig01
    Fig 01


CLASSPATH

If you are compiling against a file contained in another directory (or in a .jar in another directory), you can set the classpath to the location of the file and compile from where you are.
The simplest way to set the classpath is to set the CLASSPATH environment variable. For example:
setenv CLASSPATH .:/user/bseay/allmyfiles
You can also do it when calling javac:
javac -classpath .:/user/bseay/allmyfiles superhardprogram.java
This is also true for running a file.

Troubleshooting

To Top of Page To Top Of Page

To Top of Page To Top Of Page Printer Friendly Version

©CSG Helpdesk

Valid CSS!