Installing Java and Java Editors

Big thanks to Kiron Roy for oh-so-kindly providing the Windows instructions and diagrams on this page.

Terminal Windows

Mac OS X

You can find your terminal window in the Applications/Utilities folder. Voila!


Click Start-->Run then type in cmd. If you are on Windows Vista, you can search for run in the search bar.

You should get a black box called the command prompt. This is like the Unix/Linux/Mac Terminal. Get to the directory you want by typing cd <path> (without the angle brackets). Now you can maneuver around in a similar way to the terminals in labs.

Installing Java

Mac OS X

You shouldn't have to do anything, Java is already installed on your machine.


Go to the Sun Java SE website to obtain the most current Java installation.

To download Java SE, click on the JDK version 6 update 4 link. Choose your OS. For some reason, the x64 version doesn't work on Windows Vista, even though it should. Select Windows Online Installation.

Important: When Installing Java SE, make sure the path name has no spaces in it. For instance, Do NOT install it in C:\Program Files\Java\jdk.... This will cause problems when you try to compile or run programs because windows is silly. Remember where you instal Java SE!!! (I recommend something like C:\java\.)

Installing jEdit

jEdit is the (free) editor Alexa uses in class. It's nice because it runs on all platforms, and supports things like syntax-highlighting. Did I mention it's free?

For both Mac OS X and Windows, the first thing you should do is go to jEdit's download page. I would recommend that you download the latest stable version for your operating system.

Follow jEdit's installation instructions. Once you've got it all set up, you can now edit java files in jEdit: in a terminal window, in the desired directory, type jedit <filename>.java &. This will open up a jEdit java file with all the pretty colors. Program away!

Once you're ready to compile, save your program. Compiling will be different in different operating systems. Mac OS X

In the same directory as the java file you wish to compile, type javac <filename>.java. If the compilation is successful (there are no errors), you can run your program by typing java <filename>. Windows

Go back to the command prompt and make sure you're in the correct directory (you can check that your file is there by typing dir). I hope you remembered where you installed Java SE. If not, then search for javac.exe. Find the path for javac.exe and type that into the command prompt followed by <filename>.java

To run your file, do the same thing you did to compile, but instead of javac <filename>.java, you need only type java <filename>.

It's pretty annoying to type C:\Java\bin\javac <filename>.java every time you want to compile, right? Well, you can add a path variable to make Windows automatically search certain directories for executables such as javac.exe. This removes the necessity of typing the entire path over and over, every time you re-open the command prompt.

To do this, go to Control Panel-->System-->Advanced System Settings-->Environmental Variable. Then add your path to both User Variables and System Variables. Do this by clicking add, typing a variable name (say, JavaC) and then typing the path of javac.exe and java.exe (This should be the same path, so you only need to add one variable to both the User Variables and System Variables).

You can test this new variable in the command prompt. In theory, you should be able to just type javac <filename>.java to compile and java <filename> to run your program. However, in my case, Windows decided to be fun and only allow me to run using this method, but to compile, I have to type the whole path out. Luckily you can press the up arrow to paste in any previous commands.

If this has been helpful to you (or even if it hasn't), thank Kiron Roy for taking the time (and frustration, I can only imagine) to figure this all out.