Intro: Java and Linux

Java is our programming language. We will use this command the computer to do things. One of the nice properties of Java is that it can be written and compiled for just about any Operating System ( Unix/Linux, Windows, MacOS X, etc ). There are a hundred different ways and programs that can be used to program Java. Unfortunately, I only have time to teach one. Since most of you will be going the EWU, I will teach a method that they seem to prefer. All EWU CS students will take an advanced programming exam, and that exam will be given in the Linux operating system. So, BETTER GET USED TO IT!

Virtual Box

The easiest way to install Linux is on a fresh computer with no other operating system or data on it. Unfortunately, almost no one has a spare computer lying around. But the good folks at virtual box have the next best thing! A computer program that pretends to be brand new computer. The nice thing about virtual box is that it is a program that you can install on your computer, and you if you don't like it, or it acts up, you just REMOVE IT like any other program. NEAT!

So, let's get started.

  1. Visit Virtual Box Downloads .
  2. Find the section that reads: VirtualBox platform packages. Then select the host operating system. This is the operating system of the computer you are currently using.
  3. Then download and install the virtual box software. This is should be pretty easy. It installs like any other piece of software. Just go with the defaults for every option but hard drive size. You want to give yourself at least 20GB, but 50GB would be better.


Linux is an operating system that comes in many flavors or distributions. People spend hours of their lives arguing which flavor is the best. I used Ubuntu since it is the easiest. We will need a copy of Linux to get things started.

  1. Visit the Ubuntu main page .
  2. Select the Download Ubuntu Link
  3. Then select the Ubuntu Desktop Link.
  4. Then choose your flavor, 64 bit works for us.
  5. Then click the download link.
  6. You should get a file that ends in .iso. This is called an image. You should burn this image to a DVD.

Installing Ubuntu Linux on Virtual Box

Good news! Virtual Box has several neat instructions for you to follow. . Sections 1.6-1.8 are what you need.

Installing Java on Ubuntu

Thankfully this part is painfully easy!

  1. Boot into Ubuntu Linux and log into your account
  2. Open up a command prompt ( hitting control-alt-T at the same time ).
  3. at the command prompt, type: apt-get install update
  4. at the command prompt type: apt-get install openjdk-7-jdk. Sudo means "switch user and do". The default with sudo is to switch to the root user. apt-get is the program that Ubuntu uses to manage software. install is the argument given to apt-get to install software. openjdk-7-jdk is where our java development kit is installed.
  5. At the command prompt type: apt-get install emacs24. This will install emacs, our favorite text editor.


Some users have noticed that the ubuntu window in virtual box is really small. Here are two ways to fix that.

Method 1 (thanks Matt Osler and Nick Quaschnik)

  1. Log into your linux account.
  2. While in Ubuntu via Virtual Box... locate the 'Devices' tab up above on the task bar.
  3. Click on the devices tab and then select the bottom option... which should be called 'Guest Additions Image Disk' or something along those lines.
  4. It will then ask if you are okay with installing these additions. Click OK.
  5. It will then ask for your password. Type it in and click OK again.
  6. The Linux terminal will then pop up and start "doing things"... aka installing these additions. At some point it may ask you to hit the Enter/Return key or type 'yes' and then hit Enter/Return to continue doing its thing. Once it is all done installing it will ask you to hit Enter/Return to close the terminal window.
  7. At this point shut down the Linux virtual machine and then restart it.
  8. Voila! I am now viewing my Linux desktop in 1600x1200. You can even adjust the display by clicking and dragging the window to something smaller or larger. 1600x1200 seems to be just fine though.

Method 2 (Jacob Tuininga)

  1. After installing Ubuntu on the virtual machine the screen may look very small will not let you adjust the resolution. To solve this issue open up the terminal (Ctrl+Alt+T) in the Ubuntu virtual machine and run the following commands: "sudo apt-get install dkms" and "sudo apt-get install virtualbox-guest-additions-iso" This installs certain software that allows Ubuntu to understand it is a slave to VirtualBox.
  2. Shutdown the Virtual Machine and restart your computer. Once booted back up run the virtual machine and get to the Ubuntu desktop, put the virtual machine into full screen and the resolution should adjust to your native screen.