[vtkusers] Get Java example App2 working under W95

George Wilson g.b.wilson at anglia.ac.uk
Fri Jul 20 08:19:55 EDT 2001


Dear All, especially newbies.

As a newbie myself I thought I would provide info on how I got the
App2.java example (created when vtk is installed with java support)
working, under W95 using JDK1.3.1. The application renders a rectangular
box in a window above a control panel. In my case, the java directory
was installed to <c:\vtk32\java>, and my chosen working directory is
<c:\javaprogs>.

1. Copy the vtk.jar file from <c:\vtk32\java> to the ‘ext’ sub-directory
within the directory tree of your JDK1.3.1 installation, eg
<c:\jdk1.3.1\jre\lib\ext>. This simplifies subsequent javac commands.

2. Copy files VTKModel.java, plate.vtk and App2.java from
<c:\vtk32\java> to <c:\javaprogs>. App2 use the extra class VTKModel and
needs plate.vtk.

3. Navigate in a DOS window to c:\javaprogs and type:

javac   VTKModel.java

 Ignore any notes about deprecation.

4. Open App2.java in an editor (eg Notepad) to correct a syntax error,
if present. Two successive lines half-way through the code call the
method ‘GetRenderer’. The capital ‘G’ should be lower-case so edit
accordingly if necessary. Compile App2 with:

javac App2.java

and ignore any notes about deprecation.

5. Execute with

      java  -cp  c:\jdk1.3.1\jre\lib\ext\vtk.jar;.  App2

      note the full-stop, indicating the current directory.


Note that the file vtkPanel.java, if present in <c:\vtk32\java> is not
needed as the archived version in the jar file is used.

JDK1.3.1 supports java extensions, hence the classpath need not be
specified using javac. However I found the java command still requires
its explicit inclusion.

Hope someone finds this useful.

George Wilson
Dept. of Computer Science
Anglia Polytechnic University








More information about the vtkusers mailing list