6.5 million software developers and still going strong

Java Developer Magazine

Subscribe to Java Developer Magazine: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Java Developer Magazine: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Java Developer Authors: Stackify Blog, Douglas Lyon, Glenda Sims, APM Blog, Pat Romanski

Related Topics: Java Developer Magazine

Java Developer : Article

Java Feature — Graph3D

Visualizing data using Java3D

Installing Java3D
To run Graph3D, you'll have to have Java3D installed on your computer. Java3D can be downloaded at java.sun.com/products/java-media/3D/downloads. If your computer is a PC, you may have to install OpenGL or DirectX. Most PCs automatically come with OpenGL or DirectX installed, but if yours doesn't, see www.microsoft.com/downloads. To run Java3D on Unix workstations see the workstation maker Web site for Java3D support.

Running Graph3D
To compile the Graph3D application, type the following command in a DOS window from the directory containing the source code:

javac -classpath .; *.java

To run Graph3D as a standalone application in a DOS window, type the following command from the source code directory:

java -classpath .; Standalone

As with computer games, the quality of the Java3D display depends heavily on the quality of the graphics board installed in the computer. Low-end boards tend to leave out parts of the display like lines, surfaces, and text.

Running from a Browser
Java3D can be run from both Netscape and Microsoft Internet Explorer (IE) web browsers. When installing the latest version of the Java JDK, the install process automatically points your web browser to the developer's kit. As long as you installed Java3D to this version of the JDK, all the work is done for you. To verify which version of the JDK your browser will use, go to the "Control Panel" on your PC and click on the Java menu.

To run Graph3D from one of these browsers, open the file AppletGraph3D.html (included in the source code) from your browser. Since Graph3D is expecting input from a data file on your local PC, you'll have to grant "read" file permission to the file plot3D.dat in the java.policy file. This is located in the "jdk_install_directory/jre/lib/security" directory. The syntax for granting permissions is:

grant codeBase "file:/C:/source_code " {
permission java.io.FilePermission "C:/source_code/plot3D.dat",read";

Granting permissions this way lets any applet running in the browser access your local file. So do this for demonstration purposes only. Realistically, a browser running the Graph3D applet won't use data from a file on the local computer. The user must change Graph3D appropriately to get the data from the server and format it.

Please view the Author's Source code

There are many fine commercial off-the-shelf (COTS) graphing packages available. While they may currently solve your particular graphing needs, writing your own graphing software gives you total control and lets you change it in any fashion desired. This will be beneficial in the long run since it will be totally portable and there will be no need for licenses, upgrades, or maintenance fees. Besides, the vendor may not incorporate any bug fixes or desired features not currently in a COTS package any time soon. Graph3D provides the core classes and technology for Java3D programming and can be used as a starting point for developing your own graphing application. As you've seen, Graph3D isn't a complex application and hopefully you'll consider using Java3D in your current or future projects.

More Stories By Valor Dodd

Valor Dodd is a Java-certified senior software engineer at Lockheed Martin in Denver, Colorado. He has more than 20 years of software experience developing computer graphics and GUI applications for the telephone and defense industries.

Comments (6) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
Jerry Schultz 06/11/06 04:50:17 AM EDT

Same comment. I am beginning work on similar classes. Was excited to read that it was done and the article stated that this is how you complile the source code and then no source code. An email with the source code link would be great!

Bob Byrnes 06/01/06 06:02:43 PM EDT

At the risk of being repetitious, I too would like to find the source code for Graph3D.

Anders Lindstrom 05/26/06 08:36:58 PM EDT

The section "Running Graph3D" implies that the source code is available but I cannot find it.

Chaouki MAIZA 05/26/06 10:00:36 AM EDT

Hi there,

Sorry for repeating the question but, is the Graph3D source available for download???

Chris Pratt 05/24/06 05:51:48 PM EDT

I was a little disappointed with the article. I thought it was going to show me how to do cool things with Java3D, not just talk about what the author had done for himself! Especially since it doesn't appear that the code discussed in the article is available. I usually expect more from JDJ.

Jeff Dinkins 05/24/06 01:25:28 PM EDT

Hi - where might one download the Graph3D application you're mentioning?