[vtkusers] vtk and Java and VJ#

Bob Palank bob at stlcc.org
Thu Aug 29 07:44:14 EDT 2002


Can anyone shed light on this ?
I'm attempting to use Microsoft's VJ# (java code)with vtk40 running under
XP.

I downloaded the dlls from the vtk website and did not rebuild them, nor did
I rebuild the vtk.jar.

MSDN support asks :

Are the DLLs native Win32/COM Dlls or are they containing embedded .class &
resource files (Like is possible using the JExeGen tool of VJ6).

If the DLLs are native Win32 Dlls being accessed through JNI, then this is
not supported in Visual J#. You will have to move to using P/Invoke or COM
inter-op services of .NET Fx.

If on the other hand, these DLLs contain embedded .class/resource files,
then you need to convert the classes to managed assemblies before using in
VJ# app. For this you can use the VJ# binary converter tool (JbImp.exe).
When using JbImp.exe - please confirm that there are no legal restrictions
from the vendor of the .class files on doing a binary conversion. Note, that
JbImp does not support extracting embedded .class files in Win32 Dlls. The
tool must be run on the original .class files on which JExeGen (or similar
tool) was run.
Regarding the behaviour of System.loadLibrary, we follow the same semantics
as the Win32 LoadLibrary API. If a path is specified then the DLL is looked
for in that path. If no path is specified then the search heuristics of the
Win32 LoadLibrary API is followed. The MSDN documentation for Win32
LoadLibrary API has these heuristics.

-----Original Message-----
From: vtkusers-admin at public.kitware.com
[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Bob Palank
Sent: Tuesday, August 20, 2002 4:14 PM
To: vtkusers at public.kitware.com
Subject: [vtkusers] vtk and Java


Running in Borland JBuilder 60 - Java under XP Pro

1. I Rebuild the project and the build succeeds.
2. Project runs fine when the lines below are commented out.
     // vtkConeSource cone = new vtkConeSource();
     // cone.SetHeight( 3.0 );
     // cone.SetRadius( 1.0 );
     // cone.SetResolution( 10 );
3. when // vtkConeSource cone = new vtkConeSource(); is uncommented, the
build fails with the following error.
"cone02.java": Error #: 300 : class vtkConeSource not found in class
cone02.cone02 at line 27, column 6

4. I thought the import vtk.*; and System.loadLibrary() should get me beyond
this point, but I must be missing something!

TIA
  Bob Palank

Fortunately, I had this running before I did a system rebuild!
The tutorial code follows.



 =============================================================
Java Code follows:
//                                  Source vtk Tutorial Step 1.

//
// This example creates a polygonal model of a cone, and then rendered it to
// the screen. It willrotate the cone 360 degrees and then exit. The basic
// setup of source -> mapper -> actor -> renderer -> renderwindow is
// typical of most VTK programs.
//

package cone02;
import vtk.*;  // be sure to add a Path to d:\windows\system32 for vtk.jar

public class cone02 {
  static {
    System.loadLibrary("vtkCommonJava");
    System.loadLibrary("vtkFilteringJava");
    System.loadLibrary("vtkIOJava");
    System.loadLibrary("vtkImagingJava");
    System.loadLibrary("vtkGraphicsJava");
    System.loadLibrary("vtkRenderingJava");
    /* ======================================================
    ======================================================= */
}

  public static void main(String[] args) {

     // vtkConeSource cone = new vtkConeSource();
     // cone.SetHeight( 3.0 );
     // cone.SetRadius( 1.0 );
     // cone.SetResolution( 10 );



    System.out.println("20Aug02  Pass 05");

  }
}

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020829/3e4e962c/attachment.htm>


More information about the vtkusers mailing list