[All]
How to add Java 3D to JBuilder.
By: Josh Fletcher
Abstract: Steps to add Java 3D to JBuilder and run an example program.
|
Question:
|
|
How do I add Java 3D to JBuilder and configure it to run Java 3D programs?
|
| |
|
Answer:
|
|
Note: The following instructions assume that you are using JDK 1.2.x. They also assume that you have followed all suggestions given herein. These instructions were tested using JBuilder 3 Standard - Windows Edition, but are adaptable to other versions of JBuilder that support Java 2.
Downloading the software:
Download the Java 3D API from Sun.
We recommend using the latest, non-beta realease (version 1.1.3 at the time of this writing) of Java 3D for OpenGL. We also recommend that you download the installation for the JDK (with examples) rather than the installation for the JRE. You may also wish to download the API documentation.
Installing the API and Documentation:
- Install Java3D to the location of a Java 2 JDK of your choice (we recommend installing in an existing JDK/JRE outside of the JBuilder directory structure), i.e. "C:\jdk1.2.2". The installer will copy the Java 3D dll files to the "\jre\bin" directory of this JDK, and the archives to the "\jre\lib\ext" directory.
- Install the Java3D docs relative to the installation in step 1. For example: "C:\jdk1.2.2\doc".
Adding Java3D to JBuilder:
- Start JBuilder.
- Open your Default Project Properties.
- In the Libraries section select Add.
- Press New.
- In the Name field, type "Java 3D" (or some other name that makes sense to you).
- Press the "..." button to add files to the Class path.
- Based upon the location of your Java3D installation, select the following jar files (If you installed Java3D to the default, these files will be in your "\jre\lib\ext" directory):
- j3daudio.jar
- j3dcore.jar
- j3dutils.jar
- vecmath.jar
- Press "Ok".
- Press the "..." button to add files to the Source path.
- One level above the jre directory, find and select the following jar file:
- Press "Ok".
- Press the "..." button to add files to the Documentation path.
- Navigate to the doc directory from step 2 in "Installing the API and Documention", i.e. "C:\jdk1.2.2\doc".
- You should see a subdirectory called "j3dapi". Select this.
- Press "Ok".
- Press OK; you are done.
Running and example Java 3D application in JBuilder:
- Create a new Project in JBuilder, i.e. "hello.jpr". Save the Project file in the HelloUniverse example directory that was created when you installed Java 3D, i.e. "C:\jdk1.2.2\demo\java3d\HelloUniverse".
- Edit the Project Properties so that the source path for the Project is the above directory, i.e. "C:\jdk1.2.2\demo\java3d\HelloUniverse".
- Set the Class path to whatever you would like.
- If necessary, add the Java 3D library to the Libraries section of your project.
- Important Step: the Target JDK for your project must match the JDK into which you installed Java 3D. For example, if you installed Java 3D to "C:\jdk1.2.2", then you will need to define this JDK as the target of your project. This is becuase the Java Virtual Machine needs to know where to find the Java 3D dll's. You may also alternatively specify the location of the dll's in the "load.library.path" to the VM.
- Close the Project Properties dialog.
- Now add the HelloUniverse.java and HelloUniverse.html files to the Project.
- Select HelloUniverse.java and Rebuild it. JBuilder may give you warnings about source not being available for classes. You can ignore them, as you don't have the source.
- Select the HelloUnivers.html file and hit Run. The HelloUniverse applet should launch.
|
| |