How to use Java and BlueJ on your own computer

There are three pieces of software you must have in order to do your labs and project on your own machine:

  1. The BlueJ installer, which installs the BlueJ Integrated Development Environment (IDE) for Java that provides a simple way to edit, test, and run your programs. The MS Windows and Mac OS X versions of the installer also contain the Java Development Kit (JDK), and installing BlueJ will also install Java 8 JDK on your computer. For other operation systems, you will need to download JDK from Oracle website and install it on your computer before installing BlueJ.
  2. The acm.jar file, which contains the ACM Java Library, the graphics library that we will use. There are links to the documentation of the library on the top of this page.
  3. The ACM Invoker, the extension of BlueJ for running programs based on ACM Java Library.

Follow the instruction blow to install them on your computer. Once you have installed them for the first time, you shouldn't have to do it again. If you have any problem, the lab instructor will help you install them on your computer.

Step 1: create a folder on your desktop and download all three into the folder, making sure that you get the right version of Java and BlueJ installer for your "platform" (hardware and operating system). The ACM Java library is platform-independent since it's written in Java itself.

Once you have downloaded all the software, run the BlueJ installer and follow the directions to complete the installation of JDK and BlueJ.

Step 2: you must set up BlueJ so that it knows where to find the file acm.jar. In order to do this, start up BlueJ, in the menu, choose Tool -> Preferences (on Mac its BlueJ -> Preferences), and under the tab Libraries, click Add to find and select the acm.jar file you have downloaded.

Step 3: to install the ACM Invoker extension of BlueJ, follow the instruction below (from BlueJ Website):

Installing extensions

Extensions are installed by placing the extension jar file into an extension directory. BlueJ has three separate locations for extensions, each giving the extension a different scope. The locations are:

Location Availability
 
<BLUEJ_HOME>\lib\extensions (Windows), or
<BLUEJ_HOME>/BlueJ.app/Contents/Resources/Java/extensions (Mac, right-clickBlueJ.app and choose Show Package Contents), or <BLUEJ_HOME>/lib/extensions (Unix),  
For all users of this system in all projects.
<BLUEJ_HOME> is typically in C:\Program Files (x86)\BlueJ\ (Windows) or Applications\BlueJ\ (Mac)

Step 4: you need to configure your web browser to view Java Applets. Some web browsers such as Chrome, Edge and Firefox do not support Java Applets. In this case, please use Internet Explorer, or Safari to open the lab web pages. You may also need to add "http://www.cs.lafayette.edu" (or "http://cs.lafayette.edu" depending on your computer) to the Exception Site List in the Security Settings of Java, which can be accessed from system setting (or from Application menu on Windows 10). Please see me for help.

Step 5: To verify that your browser is properly configured, go to "http://www.cs.lafayette.edu/~gexia/cs104/labs/lab1/" and see that the Java applet is running. To complete the installtion of your BlueJ, download this file and unzip it into a directory for CS104. Double click on package.bluej file to open it in BlueJ. Then try to compile it. After it is successfully compiled, right click on RobotAndPizza and select "Run ACM Program" to run the program. This will be the basis of your program. You will modify and extend this program to accomplish the first lab assignment.