COSC 1P02 – Getting Started with Installing Java Department of Computer Science Brock University September 8, 2020 Contents 1 Introduction 2 2 Installing JDK on Windows 2 2.1 Firewall . . . . . . . ....

The assignment also needs to use the packages given in the first pdf.


COSC 1P02 – Getting Started with Installing Java Department of Computer Science Brock University September 8, 2020 Contents 1 Introduction 2 2 Installing JDK on Windows 2 2.1 Firewall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3 Installing JDK on Mac 5 4 Downloading DrJava on Windows 6 4.1 Harmful Warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Downloading DrJava on MAC 7 5.1 Harmful Warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5.2 Unidentified Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6 Adding Brock Packages to DrJava 10 7 Creating & Running Your First DrJava Project 12 8 Tips you Must Know 19 1 1 Introduction We will be explaining how to install Java (the JDK) and DrJava (the IDE/text editor) on your machine. Then, we discuss how to import Brock’s packages into DrJava and how to create a new DrJava project. We conclude with compiling and running a sample code. 2 Installing JDK on Windows We need to visit the following website: https://docs.aws.amazon.com/corretto/lates t/corretto-8-ug/downloads-list.html. The link allows us to install Java Development Kit (JDK) which takes care of compiling your Java code (high-level code/human-readable code) into low-level code (machine-readable code) and setup everything we need to use Java. Scroll down a little bit until you see the following: Figure 1: Download section for Windows. You should click on https.. //corretto.aws/downloads/latest/amazon-corretto-8-x6 4-windows-jdk.msi, which is a Microsoft installer file. Once downloaded, we need to open it and follow these steps: Figure 2: The start of the wizard. NOTE! The latest version of Amazon Corretto will not be the same as the one used in this tutorial. When this tutorial was written, the latest version was 1.8.0_222. You will have a different version but that’s totally fine. 2 https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html • Step 1) Click Next . Figure 3: Choosing an installation directory. • Step 2) You will be prompted to choose the installation directory. Leave it the same i.e., C:\Program Files\Amazon Corretto\ and hit Next . Figure 4: Confirming installation. • Step 3) Click Install . 3 • Step 4) Give it five minutes and you will get: Figure 5: The completion of the wizard. Click Finish . We now have our JDK installed! 2.1 Firewall In the case you get something like this: Figure 6: Firewall suggested access. 4 Make sure you check the first box and uncheck the second (as shown above) and then click Allow access . 3 Installing JDK on Mac We visit the following website: https://www.oracle.com/java/technologies/javase/ja vase-jdk8-downloads.html. Scroll down to macOS x64, you should see: Figure 7: Download section for Macs. NOTE! The latest version of the JDK might not be the same as the one used in this tutorial. When this tutorial was written, the latest version was jdk-8u261. You might have a different version, probably Java jdk-8uxxx. Download the Mac OS X x64 version which will have the name jdk-8uxxx-macosx-x64.dmg. It will show you a dialog prompting you to accept the Oracle Technology Network License Agreement for Oracle Java SE. Make sure you check the box and click on jdk-8uxxx-macosx-x64.dmg. You will be prompted to login. Since you don’t have an account, you need to signup. So, scroll down and signup. Complete the signup and activate your email etc. Once we are done, we can login and download the file. Once downloaded, You should click on something like jdk-8uxxx-macosx-x64.dmg which is a Mac installer file. After the download, we need to open it to see something like: Figure 8: Java 8 Mac installer. Again, the name differ but that’s fine. Click on Java 8 update xxx.pkg and follow the installation guide (a simple wizard to com- plete). 5 https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html Figure 9: Initial JDK setup on Mac. • Step 1) We need to click Continue . We get the following: Figure 10: Intalling JDK on Mac. • Step 2) We click Install and wait a few minutes. After that, we should be click Close to close the wizard. We might get a dialog box suggesting to Keep the installer or Move to Bin. You could choose either, if you are still unsure, click Keep . We have officially installed the JDK! Let us install the IDE, DrJava. 4 Downloading DrJava on Windows Now that we have our JDK installed, we can then install DrJava (we need the JDK in order to run DrJava). To download it, visit https://sourceforge.net/projects/drjava/file s/1.%20DrJava%20Stable%20Releases/ and click on 6 https://sourceforge.net/projects/drjava/files/1.%20DrJava%20Stable%20Releases/ https://sourceforge.net/projects/drjava/files/1.%20DrJava%20Stable%20Releases/ Download Latest Version drjava-beta-20xxxxxx-xxxxxx.jar . At the time of writing this tutorial, the version was drjava-beta-20190813-220051.jar. 4.1 Harmful Warning After downloading, we should be able to open it by clicking on it. If you cannot, then you might encounter something like this: Figure 11: Warning suggesting that DrJava might be harmful. This is just a warning so choose Keep . You might have different options depending on the browser you are using (i.e., Chrome, Firefox etc). You might have a more options button, click it and select an option that will save/keep the file. That’s it! We have DrJava ready! you can open it now and it should work as expected. In the case you cannot open it, it means something wrong happened during the previous steps. The best thing to virtually seek help from help desk (visit https://www.cosc.brocku.ca /~pbork/HelpDesk_Schedule.pdf) if you encounter any issues. 5 Downloading DrJava on MAC Now that we have our JDK installed, we can then install DrJava (we need the JDK in order to run DrJava). To download it, visit https://sourceforge.net/projects/drjava/fi les/1.%20DrJava%20Stable%20Releases/drjava-beta-20160913-225446/ and click on drjava-beta-20160913-225446.jar. 5.1 Harmful Warning After downloading, we should be able to open it by clicking on it. If you cannot, then you might encounter something like this: Figure 12: Warning suggesting that DrJava might be harmful. This is just a warning so choose Keep . You might have different options depending on the browser you are using (i.e., Chrome, Firefox etc). You might have a more options button, click it and select an option that will save/keep the file. That’s it! We have DrJava ready! you can open it now and it should work as expected. In 7 https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf https://sourceforge.net/projects/drjava/files/1.%20DrJava%20Stable%20Releases/drjava-beta-20160913-225446/ https://sourceforge.net/projects/drjava/files/1.%20DrJava%20Stable%20Releases/drjava-beta-20160913-225446/ the case you cannot open it, it means something wrong happened during the previous steps. The best thing to virtually seek help from help desk (visit https://www.cosc.brocku.ca /~pbork/HelpDesk_Schedule.pdf) if you encounter any issues. 5.2 Unidentified Developer After that, we should be able to open it by clicking on it. It is highly likely that we get the following: Figure 13: The application is from an unidentified developer. This occurs because Apple doesn’t recognize DrJava, there is nothing wrong about this. We need to accept DrJava as a reliable application. To do that, click Ok . Go to your start menu and choose System Preferences.... Figure 14: How to access your System Preferences. Then click on Security and Privacy (first row, sixth column). 8 https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf Figure 15: Locating where Security and Privacy (first row, sixth column). We will get something like this: Figure 16: Accepting DrJava as a reliable program. 9 We need to click Open Anyway . That’s it! We have DrJava ready! you can open it now and it should work as expected. In the case you cannot open it, it means something wrong happened during the previous steps. The best thing to virtually seek help from help desk (visit https://www.cosc.brocku.ca /~pbork/HelpDesk_Schedule.pdf) if you encounter any issues. 6 Adding Brock Packages to DrJava To add Brock’s packages to DrJava, follow these steps: • Step 1) Visit https://www.cosc.brocku.ca/archive/java. • Step 2) You should see a section called “Tools (download)" and under that, a bullet Brock Packages. Click on it to download a .zip file. • Step 3) Once the download is complete, click on it. You will see one folder named Documentation (which we don’t care about for now) and two files: BasicIO.jar and Media.jar. Unzip the files (if you don’t know how to, you can drag both files to your desktop). You can keep them on your desktop or place them in another place (i.e., Documents, etc.), as you prefer. NOTE! Once you place them in a place you desire, you cannot change the directory of these files anymore nor delete them or change their name as long as you are using DrJava. • Step 4) Open DrJava. • Step 5) On the top left corner of the screen, navigate to Edit → Preferences... (the last option). We should see something like: 10 https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf https://www.cosc.brocku.ca/~pbork/HelpDesk_Schedule.pdf https://www.cosc.brocku.ca/archive/java Figure 17: DrJava preferences window. • Step 6) Click on the Add button near “Extra Classpath", navigate to the directory you placed the two files, select BasicIO.jar and click Select . Do the same for Media.jar. Now, you have imported the packages and your screen should look like: Figure 18: Making sure that the packages are added to “Extra Classpath". • Step 7) Click on OK . We now have added Brock’s libraries to DrJava! 11 7 Creating & Running Your First DrJava Project For your labs
Feb 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here