University of California at Berkeley Department of Electrical Engineering & Computer Sciences Instructional Support Group /share/b/pub/java.help /share/b/pub/junit.help Apr 29 2008 CONTENTS: Java on our UNIX computers Java on our Windows computers Javadoc Junit Coverity Prevent Troubleshooting For more information Bug Reports Java on our UNIX computers -------------------------- There are a variety of versions available. You can find the Instructional computers via http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi First, set your JAVA_HOME environment variable for the version you want: To use this | (`uname -a`) | version of | On these UNIX | Set your JAVA_HOME environment Java: | computers: | variable to: =============+===================+================================= Java 1.6 | Solaris X86/SPARC | /usr/sww/lang/jdk-1.6.0_04 Java 1.5 | Solaris X86/SPARC | /usr/sww/lang/jdk-1.5.0_12 Java 1.5 | Ilinux* (Linux) | /usr/local/pkg/jdk1.5.0_15 Java 1.4 | Ilinux* (Linux) | /usr/lib/jvm/java-1.4.2 Java 1.5 | Icluster* (Linux) | /usr/lib/jvm/java-1.5.0-sun-1.5.0.10 Java 1.4 | MacOSX | /usr/lib/jvm/java-1.4.2 =============+===================+================================= On Solaris, type 'ls -d /usr/sww/lang/jdk*' to list the current versions. On MacOSX and Linux, type 'locate javac' to list the current versions. For example: setenv JAVA_HOME /usr/sww/lang/jdk-1.5.0_12 Then, prepend $JAVA_HOME/bin to your path, using the commands: set path = ($JAVA_HOME/bin $path) rehash You can add the 'set path' statement to the end of your ~/.cshrc file to cause the path adjustment to take effect every time you log in. Here is an example of the commands to run a Java program: setenv JAVA_HOME /usr/sww/lang/jdk-1.5.0_08 set path = ($JAVA_HOME/bin $path) rehash javac MyProgram.java # creates MyProgram.class java MyProgram You can verify which version of Java you are using with the command: java -version You can locate the Instructional computer of your choice using: http://inst.eecs.berkeley.edu/clients Java on our Windows computers ----------------------------- In 330 Soda, several versions of the JDK are in C:\Program Files\Java Javadoc ------- The "javadoc" program generates HTML output suitable for use with a WEB browser. There is one flaw: it includes references to gif files in an "images" directory that are relative to your home directory, and that probably won't be there. We have installed these files on the Instructional WEB server under "/images". So you can correct the links to these gif files simply by adding a single forward slash character (/) in front of the word "images". The http://inst.eecs.berkeley.edu WEB server will interpret that as a reference to the "/images" directory on the server. Junit ----- JUnit (http://www.junit.org/) is a unit testing framework for the Java. It includes classes that you import into your Java program. Junit is installed as an Eclipse plugin on the EECS Instructional UNIX systems. It can also be compiled into your stand-alone programs (ie using 'javac', etc). It has a textual and a graphical interface. References: http://junit.sourceforge.net/ http://clarkware.com/articles/JUnitPrimer.html Coverity Prevent --------------- Coverity Prevent is a Java debugger. See http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=coverity.help for information about Prevent on the EECS Instructional computers. Troubleshooting --------------- On Intel Solaris machines, you might get an error that looks like "ld.so.1: /usr/sww/lang/java-1.2.2/bin/i386/native_threads/java: fatal: libhpi.so: open failed: No such file or directory". This is because you have used "/usr/bin/java", or some other "java", instead of one of the recommended versions. Please be sure your JAVA_HOME and PATH variables are set right. (see the JAVA_HOME section above) If Java dumps core on you when compiling or your programs abort spontaneously with no obvious error message, you may have run out of memory. To work around this, here are some things you can do before or during your compile jobs: * Quit other programs (e.g., Emacs, Netscape) and close any random xterms or windows you're not using * Log into a bigger machine (such as c199.eecs) You can do this with the "ssh" command. For example, to log in to c199.eecs in a new window named "C199": % xterm -T C199 -e ssh c199.eecs & For more information -------------------- Please see the following Web sites: http://java.sun.com/products/OV_jdkProduct.html http://developer.java.sun.com/developer/infodocs/ Bug Reports ----------- Please report problems with software on the Instructional systems to inst@eecs.berkeley.edu. Instructional Support Group 378/386/384 Cory, 333 Soda inst@eecs.berkeley.edu