Schedule and Assignments > PSA7 > How do I get appletviewer to work on my home computer?'First off, what is appletviewer and why do I need it?!'
Appletviewer is actually a command-line program that allows you to view applets. Applets are generally designed to work on web browsers (like Chrome, Firefox, Safari, etc), but appletviewer enables you to see them without the use of those browsers. If you're working on PSA7 from home, you will need to get appletviewer to run on your computer to actually see the results of your code.
Appletviewer is a program that is included with the JDK package (Java Development Kit). This is different from JRE (Java Runtime Environment) which most of you might already have. So, if you don't already have JDK on your computer, you need to download it from Oracle's website. (If you don't have JRE, don't worry, installing JDK also gives you the option of installing JRE on your computer. This stuff might seem overwhelming, but its pretty easy once you follow the instructions, so relax!) Here's the link: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Accept the license agreement and download the Kit for your machine. NOTE: If you your computer runs on Windows but you are unsure of which JDK to download, you need to first find out whether your system is 32-bit or 64-bit. To do this, go here: http://support.microsoft.com/kb/827218 If you have a 32-bit system, get the JDK for Windows x86, otherwise get the one for Windows x64. 'Downloaded! Next?'
Once you get JDK, you must install it. For Mac users: (http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html) A Finder window appears containing an icon of an open box andthe name of the .pkg file. Double click the package icon tolaunch the Install app.The Install app displays the Introductionwindow. Click Continue. Note that, in some cases, a DestinationSelect window appears. This is a bug, as there is only oneoption available. If you see this window, select Installfor all users of this computer to enable the continuebutton. Click Continue. The Installation Type window appears. Click Install. For Windows users: (http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html) 1. Double-click the installer's icon. Then, follow the instructions the installer provides. It may ask you to restart your computer. 2. Once you've installed JDK, to run it from the Windows command prompt, you have 2 options: a. Specify the full path to the executable file every time you run it, such as: C:> 'C:Program FilesJavajdk1.7.0binjavac' MyClass.java (to compile the file MyClass.java: Note that 'javac' is the command that compiles .java files.) b. It is better to set up your system so that you don't have to type the complete address of each command every single time you want to use this. To do this, you need to change what is called a PATH environmental variable in your system. Note that this is optional, but HIGHLY RECOMMENDED as it will make your life extremely easy. To do this:- Click Start, then Control Panel, then System.
- Click Advanced, then Environment Variables.
- Add the location of the
bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:C:WINDOWSsystem32;C:WINDOWS;C:Program FilesJavajdk1.7.0bin
Add the location of the bin folder of the JDK at the end of the existing PATH variable. You can add as many bin locations as you want, but only the first one will be considered (the rest will just be ignored by the computer). Changes will be in effect after you close and re-open the command prompt. (Command prompt can be accessed by typing cmd in the Search toolbar (in the Start Menu for Windows 7, regular search in Windows 8).
Please make sure you don't make any unnecessary changes to the PATH variable.
'Done! That was easy! Now what?'
Following these steps in order (carefully), will set up the environment you need to run appletviewer! After this, you can just run appletviewer using the syntax provided in the PSA7 instructions. If you have any questions or are stuck at any point, post a question on Piazza and let us know! :)
Good luck with the assignment!
|
|