General Information
Things are a bit complicated because Oracle bought Sun, which originally had developed Java, and files and URLs got moved around. In addition, Java 3D is not a Sun or Oracle product any more; it’s now a “community development project”. So, a bit of patience is needed to find the right information.
If you have not used Java before, go to the online tutorial referenced below. Then learn Swing, and then Java3D. Do not bother with the graphics capabilities of Swing, since we will use Java3D instead.
I also have a set of simple examples online in the course account in the scf facility at
~cs582/public/java
This is an scf account, not a URL. A few of these examples are adapted from the book “Java by Dissection” by I. Pohl and C. McDowell, Addison-Wesley, 2000.
There are 3 directories. I suggest that you look at the examples in the following order:
TextExs: These just write to the terminal
- HelloWorld – Can’t get any simpler than this!
- VM – Examples with vectors and matrices
SwingExs:
- HelloButton – Creates a button that you can click on, but does nothing.
- HelloGoodBye – Creates a button that serves to quit the program.
- Nesting – Shows how to use components within components.
- TextInput – Shows how to get info from text fields.
- MiniCalc – A simple calculator. Shows how to process buttons and text fields.
- SimpleMenu – Handles menus.
3dExs:
- HelloLine – Can’t be any simpler.
- HelloTriangle1 to HelloTriangle4 – Various techniques for defining wireframes.
- Transform – Shows how to rotate and translate an object.
- JCube – Shows how to change the scene transform by rotating and scaling a cube so that it fits nicely in the display.
- SphereMenu – Shows how to react to menu events and how to add new objects to a live display.
- DemoViewer – Demonstrates a simple viewer that we will use and extend, and which lets you rotate, translate and zoom by using the mouse.
Software
We will be using the following production versions of Java, Swing and Java3D.
- Java 2 Platform Standard Edition (J2SE), version 7.0. The latest version is also known as Java SE 7u25 (“u” stands for “update”). What we need is the JDK (Java Development Kit), and the current version is jdk1.7.0_25.
- Java 3D version 1.5.2.
We will develop and grade on PCs using the versions indicated above. It is your responsibility to ensure that your code runs on this platform. Other platforms can probably be used (e.g., Macs) but we will not be testing homework on other platforms or converting between platforms.
I recommend using the compilers directly on a PC run window.
javac ClassName.java
compiles the source into byte code, ClassName.class. Then
java ClassName
runs it. If you have all the source files in the same directory, the system will find what it needs and compile it. Note that the compiler may produce more files than what you expect and that all are needed and must be submitted.
Installation on PCs
You can download the required software for free as follows:
jdk 1.7.0 — Java downloads web site.
j3d 1.5.2 — Java3D downloads web site.
Make sure that you get the versions we are using.
In the PCs the jdk should install without any problems. For j3d make sure you download the installer, not the package itself.
The PC installation has a couple of environmental requirements: (i) you need to have in your PATH variable the value c:\Program Files\Java\jdk1.7.0_25\bin ahead of other entries, or at least ahead of the system directories (assuming that you installed Java in the usual place) or you won’t find the javac compiler; and (ii) your CLASSPATH variable must be set to ‘.’ or not set at all, or Java will not find the class files it needs. To set these variables in Windows XP go to Start >> Control Panel >> System >> Advanced >> Environment Variables and scroll to edit ‘Path’ in the system variables. .
Documentation
There are many texts available on Java. I recommend the online tutorials available at the java web sites. NOTE: The information on how up to date the documentation is, is not up to date itself :-). It’s true as of a couple of years ago, and I’m sure there have been changes. Beware!
In addition to the official Java and Java 3D sites, there is an independent site for Java 3D: Java 3D Organization
- Java Tutorial This is up to date to jdk1.7.0
- Swing Tutorial This seems to be up to date to jdk1.7.0
- Java Language Spec, online version of the last edition of the main Java reference book.
- Java3D Tutorial. This seems up to date.
Reference manuals for the APIs are also available online in HTML format.
- Java API, including Swing and other utilities.
- Java 3D API, including vecmath.