Troubleshooting

 

Versions and Deprecated Methods

All of the examples in the book/CD/website use version 4 Physlets. There are, however, a few examples that use deprecated methods. These are old scripts that have been updated to use version 4 Physlets.  When looking at these scripts, please keep in mind that many of those methods are no longer supported or documented in the book.  

 

Cascading Style Sheets

All of the HTML pages on this site/CD use cascading style sheets. A tag like: 
<LINK rel="STYLESHEET" type="text/css" href="../../styles_demo.css">
appears in the <head> of each page. When copying these html pages to a local hard drive, either make sure that the cascading style sheet, styles_demo.css, is in the right directory (in this example up two directories), or remove the line from the web page. While all browsers should ignore the reference to the cascading style sheet, it is our experience that not all browsers allow the web page to run properly when it cannot find the cascading style sheet.

 

Location of Codebase

All of the Physlet problems use relative addressing for the location of the codebase. This means that the applet tag, <applet>, contains the line:
codebase="../../../applets/classes/"
which tells the applet where to find the Jar files that contain the code needed to get the applet to run. When you copy a problem from the CD to your hard drive also make sure that the directory applets is three directories up or change the codebase accordingly.

 

Code Attributes

The code attribute in the applet tag usually consists of the package name followed by the class name, followed by the file extension, class. For example,

code="animator4.Animator.class" 
tells us that the file Animator.class is located within the animator4 package. You can use a decompression utility, such as WinZip, to open the jar file and observe that the jar file actually contains a file named Animator.class in a subdirectory called animator4.

 

Case Sensitivity

Remember that Java is case sensitive. Class names typically use mixed case and directories are lower case. Although many developers use lower case, we often use mixed case for Physlet jar files. We have noticed that the case of a character can sometimes change when files are copied between computers with different operating systems

 

Use of Images

Many of the problems and examples in the book use images. In order for the images to appear correctly, the line
document.Animator.addObject("image", "file=images/bball.gif","x=0,y=0");
must appear in the script and the image file must appear in the classes directory in a subdirectory called images. To facilitate this process, the images used in the scripts appear in the same directory as the HTML pages.

 

Java Virtual Machine

 The Java Virtual  Machine on your browser may be disabled—or possibly not even installed—as a matter of school or company policy.  It is even possible to enable or disable Java applets that are downloaded from particular servers.  Dealing with paranoid administrators and network security  is, of course, beyond the scope of this—or any other—book.