University of California at Berkeley Department of Electrical Engineering & Computer Sciences Instructional Support Group /share/b/pub/java.help /share/b/pub/junit.help /share/b/pub/intelij.help June 13 2018 CONTENTS: Java on our UNIX computers Java on our Windows computers Javadoc Junit Coverity Prevent Troubleshooting For more information Bug Reports IntelliJ Java on our UNIX computers -------------------------- There are a variety of versions available. On MacOSX and Linux, type 'locate javac' to list the current versions. You can verify which version of Java you are using with the command: java -version First, set your JAVA_HOME environment variable for the version you want. Here's are commands for setting your JAVA_HOME for the default version, on Linux (bash): export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") and on MacOSX (bash): export JAVA_HOME=$(readlink /usr/bin/java | sed "s:bin/java::") Here is an example of the commands to run a Java program: export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/ javac MyProgram.java # creates MyProgram.class java MyProgram You can find the Instructional computers via http://inst.eecs.berkeley.edu/connecting.html#labs. Java on our Windows computers ----------------------------- 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. Adding junit.jar to the ant build path: build.xml has the location of junit.jar on your system. In addition, you must add junit.jar to your CLASSPATH or copy junit.jar to your Ant library from your JUnit library to enable the integration of JUnit and Ant. References: http://junit.sourceforge.net/ http://clarkware.com/articles/JUnitPrimer.html http://www.vogella.de/articles/JUnit/article.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. IntelliJ -------- IntelliJ IDEA (https://www.jetbrains.com/idea/) is installed on our Linux systems under /share/instsww. To start it up open up a terminal and type: % /share/instsww/bin/idea.sh IntelliJ is installed on our Macs in 200 SDH under "/Applications/IntelliJ IDEA 2017.2 CE EAP.app/". To start it, search for "IntelliJ" in the Finder. Instructional Support Group 378/386/384 Cory, 333 Soda inst@eecs.berkeley.edu