How to Download and Use Java Source from JOMA

For some of the JOMA mathlets, 'source code' is available for your use. This page briefly introduces what Java source code is and then describes how to download and then use the Java source code found on the JOMA site.


What is source code?

Programs written in the Java programming language and ready for use are not readable; they have been translated into code which the Java Virtual Machine on your computer is able to read. For some of the JOMA mathlets, source code (the human readable version of the program) is available. You can download the source code, change it yourself (according to the author's permission) and compile it into a Java program of your own. The process of compiling changes the human-readable text into code that the Java Virtual Machine can read as a program.


How to download

First, where the author provides instructions, follow them first. There may be special procedures involved to get all of the necessary code. If the author does not provide instructions, or the source files are within JOMA itself, follow the instructions below

Where source code appears with the JOMA frame:

  1. select all of the code text
  2. copy it. Note as well the name of the file (jsrcfileName.html)
  3. open a new text file in another application (Notepad on Windows, Simpletext on Macintosh, or a development environment like BBEdit or CodeWarrior if you have one)
  4. paste the code
  5. save the file under the same name with a .java suffix and without the preceding "jsrc": fileName.java

Be sure to save all source files for a single applet together within a single folder. The compiler looks for files in specific locations.

Note that the original java files are kept in the same directory as the html files used for display. If you would like to download the source files directly and links are not provided, substitute .java for .html in your browser's Location window: http://www.joma.org/article/name/filename.java

and then save the file as text with the file named filename.java .


How to compile

To use the Java code that you've worked with, you'll need to compile the source into a Java application or applet. There are many programs available that will do this, including the following programs:

Your compiler should come with detailed instructions for compiling with that software package.

Once your code is compiled, either load the page that it is embedded within (if it is an applet) or run the application in your computer's Java Virtual Machine.