Installing Java

Rev. 8 Nov 2016




  1. If your lappy is a Windoze machine, go to this link to get the install program for the JDK (not just the JRE). Download the program, run it, and reboot your machine. Do not worry about the JRE; it is automatically obtained when you download the JDK. It is a big download, so hang around a place with a good access point whilst doing it. On this page, you can also obtain the Java 8 Documentation and install in on your box. We highly recommend you get this documentation. You will use it a lot in programming Java and it frees you from worrying about being on a network while working.
  2. If you are a Mac User, you have a JDK. You should get the documentation. see the remarks for Windoze users.
  3. If you are a debian/Ubuntu user, do this.
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get install openjdk-8-jdk
    

    You should now have java working. If you have used Java before and your machine is Java-enabled, make sure you have Java 8. We will be making a lot of use of Java 8 in 424/426.

  4. Now go to The DrJava Site and download DrJava for your platform. This site offers complete instructions on using and installing Java. If you browse the user's manual, you can learn about many productivity tools that will make programming faster, easier and more fun.

Some Linux Install Hints

Once you are done with all of your installing, reindex your HD with the command

$ sudo updatedb

This makes it easy to search for files with the locate command.

You are now ready for to program in Java.

To make things easy, make a directory called bin in your home directory. Place drjava.jar in it. You can place the drjava file in an existing bin directry if you have one. Then place this alias in your .bashrc file.

 alias drjava="java -jar ~/bin/drjava.jar"

To use DrJava, open a terminal and type

$ drjava

It should launch in a few seconds.

To See if All is Well on all Platforms Open drJava and place this text in the code window.

public class Foo
{
}

Hit F5 or the Compile buttonand you will be directed to save this code; do so under the file name Foo.java. If, in the the bottom window, you see "Compilation Completed," you are good so far. If your compiler is a Java 8 compiler, you are golden.