Fw: [vtkusers] Problems Installing vtk 4.2 with Java -- Please Help!

Jarek Sacha jarek at ieee.org
Sun Apr 4 12:22:32 EDT 2004


Sattiraju V Prabhakar wrote:

>Hi Shyam, in addition to giving the commands at msdos console,
>I tried to use a Java IDE to execute Cone.java. I added all the dlls from
>the
>vtk42\bin directory, the .lib files in vtk42\lib\vtk and jawt.dll to the
>libraries.
>  
>
The error message below means that you do not have vtkCommonJava.dll in 
you system path, at least the way you JVM sees the path. Add following 
at the beginning of you main() function :

System.out.println("java.library.path: " + 
System.getProperty("java.library.path"));

To verify that your system PATH variable is set correctly (it should 
have the directory containing vtk*.dll, including vtk*Java.dll). One 
thing that I noticed recently on some WinXP system is that dynamic 
libraries from paths containing spaces, for instance, C:\Program 
Files\vtk\bin, may not load correctly, even if you put them in quotation 
marks"". Best way to fix it is to move your dlls into a path without 
spaces, for instance c:\apps\vtk42. Other thing that may work is to 
convert you paths with spaces to "~' notation, for instance, 
c:\Progra~1\vtk42\bin (this may look slightly different depending on you 
system configuration).

>I used Intellij Idea 4.0. I get the same following error message.
>
>I get an error pane with title "Java Virtual Machine Launcher" and message:
>"Could not find the main class - program will exit".
>  
>
Looks that you selected an incorrect class to run. A simple way to run a 
class in IDEA is to open the code in the editor and press 
Ctrl+Shift+F10, alternatively right click on the class name in the 
Project or Package pane and select "Run" (if a class does not have a 
proper main() method the "Run" option will not be available).

>On the console, I get the following errors:
>java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
> at java.lang.Runtime.loadLibrary0(Runtime.java:788)
> at java.lang.System.loadLibrary(System.java:834)
> at Cone.<clinit>(Cone.java:17)
>
>Thanks!
>Prabhakar
>  
>
BTW: I do use IDEA 4 with my VTK projects, both on Linux and Windows. To 
setup an IDEA project you only need to location of the vtk.jar. Location 
of VTK DLLs and the jawt.dll can be easily handled by the system PATH 
variable (or LD_LIBRARY_PATH on Linux).

Jarek

>
>----- Original Message ----- 
>From: "Sattiraju V Prabhakar" <sprabhakar at sbcglobal.net>
>To: "R K Shyam Prakash" <ramakrishna.prakash at quest-global.com>
>Cc: "Sattiraju V Prabhakar" <sprabhakar at sbcglobal.net>
>Sent: Saturday, April 03, 2004 1:06 AM
>Subject: Re: [vtkusers] Problems Installing vtk 4.2 with Java -- Please
>Help!
>
>
>  
>
>>Hi Shyam,
>>
>>I tried a number of things to see whether java is able to run the
>>Cone.class. I get the same error. I added the jawt.dll file to vtk42\bin
>>directory. It is giving the same error. I shall really appreciate any
>>    
>>
>help.
>  
>
>>Prabhakar
>>
>>
>>
>>
>>    
>>
>C:\PRABHAKAR\Programs\Resources\Graphics_Visualization\vtk42\Examples\Tutori
>  
>
>>al\S
>>tep1\Java>java -classpath
>>.;C:\Prabhakar\Programs\Resources\Graphics_Visualizati
>>on\vtk42\bin\vtk.jar Cone
>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no
>>    
>>
>vtkCommonJava
>  
>
>>in j
>>ava.library.path
>>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
>>        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>>        at java.lang.System.loadLibrary(System.java:834)
>>        at Cone.<clinit>(Cone.java:17)
>>
>>
>>    
>>
>C:\PRABHAKAR\Programs\Resources\Graphics_Visualization\vtk42\Examples\Tutori
>  
>
>>al\S
>>tep1\Java>java -classpath
>>.;C:\Prabhakar\Programs\Resources\Graphics_Visualizati
>>
>>    
>>
>on\vtk42\bin\vtk.jar;C:\Prabhakar\Programs\Resources\Graphics_Visualization\
>  
>
>>vtk4
>>2\lib Cone
>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no
>>    
>>
>vtkCommonJava
>  
>
>>in j
>>ava.library.path
>>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
>>        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>>        at java.lang.System.loadLibrary(System.java:834)
>>        at Cone.<clinit>(Cone.java:17)
>>
>>
>>    
>>
>C:\PRABHAKAR\Programs\Resources\Graphics_Visualization\vtk42\Examples\Tutori
>  
>
>>al\S
>>tep1\Java>java -classpath
>>.;C:\Prabhakar\Programs\Resources\Graphics_Visualizati
>>
>>    
>>
>on\vtk42\bin\vtk.jar;C:\Prabhakar\Programs\Resources\Graphics_Visualization\
>  
>
>>vtk4
>>2\lib\jawt.lib Cone
>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no
>>    
>>
>vtkCommonJava
>  
>
>>in j
>>ava.library.path
>>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
>>        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>>        at java.lang.System.loadLibrary(System.java:834)
>>        at Cone.<clinit>(Cone.java:17)
>>
>>
>>    
>>
>C:\PRABHAKAR\Programs\Resources\Graphics_Visualization\vtk42\Examples\Tutori
>  
>
>>al\S
>>tep1\Java>java -classpath
>>.;C:\Prabhakar\Programs\Resources\Graphics_Visualizati
>>
>>    
>>
>on\vtk42\bin\vtk.jar;C:\Prabhakar\Programs\Resources\Graphics_Visualization\
>  
>
>>vtk4
>>2\lib\vtk Cone
>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no
>>    
>>
>vtkCommonJava
>  
>
>>in j
>>ava.library.path
>>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
>>        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>>        at java.lang.System.loadLibrary(System.java:834)
>>        at Cone.<clinit>(Cone.java:17)
>>
>>
>>
>>
>>----- Original Message ----- 
>>From: "R K Shyam Prakash" <ramakrishna.prakash at quest-global.com>
>>To: "'sprabhakar'" <sprabhakar at sbcglobal.net>
>>Sent: Wednesday, March 31, 2004 11:11 PM
>>Subject: RE: [vtkusers] Problems Installing vtk 4.2 with Java -- Please
>>Help!
>>
>>
>>    
>>
>>>Prabhakar,
>>>Can you send me the complete stack of java error
>>>messages?
>>>
>>>--Shyam
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: sprabhakar [mailto:sprabhakar at sbcglobal.net]
>>>>Sent: Thursday, April 01, 2004 10:32 AM
>>>>To: R K Shyam Prakash; vtkusers at vtk.org
>>>>Cc: Sattiraju V Prabhakar
>>>>Subject: Re: [vtkusers] Problems Installing vtk 4.2 with Java
>>>>-- Please Help!
>>>>
>>>>
>>>>Thanks Shyam for the prompt reply.
>>>>I tried it and still it is giving me the same error.
>>>>
>>>>My build from source files has not created the vtk.jar file.
>>>>
>>>>But my binary installation has created a vtk.jar file.
>>>>I used it to try what you suggested. It is giving me the
>>>>same error.
>>>>
>>>>Can you suggest me what I can do to make either of the
>>>>installations to work.
>>>>
>>>>Thanks!
>>>>Prabhakar
>>>>
>>>>----- Original Message ----- 
>>>>From: "R K Shyam Prakash" <ramakrishna.prakash at quest-global.com>
>>>>To: "'sprabhakar'" <sprabhakar at sbcglobal.net>; <vtkusers at vtk.org>
>>>>Sent: Wednesday, March 31, 2004 10:24 PM
>>>>Subject: RE: [vtkusers] Problems Installing vtk 4.2 with Java
>>>>-- Please Help!
>>>>
>>>>
>>>>        
>>>>
>>>>>Prabhakar,
>>>>>For me it doesn't seem to be a vtk problem. All you
>>>>>should do is
>>>>>
>>>>>java -classpath .;c:\vtk\vtk.jar Cone   (I am assuming vtk.jar is at
>>>>>c:\vtk. You can replace it with the actual path)
>>>>>
>>>>>and you should have the program up and running.
>>>>>
>>>>>--Shyam
>>>>>
>>>>>          
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On
>>>>>>Behalf Of sprabhakar
>>>>>>Sent: Wednesday, March 31, 2004 11:25 PM
>>>>>>To: vtkusers at vtk.org
>>>>>>Cc: Sattiraju V Prabhakar
>>>>>>Subject: [vtkusers] Problems Installing vtk 4.2 with Java --
>>>>>>Please Help!
>>>>>>
>>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>I have been trying to install vtk 4.2 with Java by
>>>>>>            
>>>>>>
>>>>building source
>>>>        
>>>>
>>>>>>code release. When I try executing Cone example, I get
>>>>>>            
>>>>>>
>>>>the following
>>>>        
>>>>
>>>>>>error.
>>>>>>
>>>>>>Exception in thread "main" java.lang.NoClassDefFoundError: Cone
>>>>>>
>>>>>>Here are the steps I followed, in detail.
>>>>>>
>>>>>>Computer Configuration:
>>>>>>
>>>>>>I am installing vtk4.2 on Windows 2000 Professional. I
>>>>>>            
>>>>>>
>>>>already have
>>>>        
>>>>
>>>>>>Visual Studio .Net and j2sdk1.4.2_02 installed. I installed CMake
>>>>>>1.8.3.
>>>>>>
>>>>>>Detailed Steps:
>>>>>>
>>>>>>1. I copied subdirectories and files of vtk-src-windows
>>>>>>            
>>>>>>
>>>>directory on
>>>>        
>>>>
>>>>>>CD-ROM onto a local directory using "xcopy".
>>>>>>
>>>>>>2. Then I ran CMake with the following settings:
>>>>>>    BUILD-SHARED-LIBS    yes
>>>>>>   VTK_WRAP_JAVA      yes
>>>>>>
>>>>>>Then I wrote out the build files using "ok" button.
>>>>>>(I indicated a new folder for binary files)
>>>>>>
>>>>>>3. My Visual Studio .Net automatically detected the new VTK.dsw
>>>>>>project file. I selected "debug" for Active Configuration and
>>>>>>applied ALL_BUILD. (Later I tried with Active Configuration -->
>>>>>>Release with the same consequences). Now I have a Debug
>>>>>>            
>>>>>>
>>>>folder added
>>>>        
>>>>
>>>>>>to CMake folder in my binaries directory.
>>>>>>
>>>>>>4. I set up my environment "path" variable to point to Debug.
>>>>>>
>>>>>>5. I compiled Cone.java using javac and then tried to execute it
>>>>>>using "java Cone". This gave the error mentioned above.
>>>>>>
>>>>>>6. Then I copied all the files in Debug and pasted them in
>>>>>>Winnt/System directory. I recompiled and executed Cone.java, with
>>>>>>the same consequences.
>>>>>>
>>>>>>I appreciate any help on this.
>>>>>>
>>>>>>Prabhakar
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>_______________________________________________
>>>>>>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://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>>          
>>>>>
>
>
>_______________________________________________
>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://www.vtk.org/mailman/listinfo/vtkusers
>
>  
>




More information about the vtkusers mailing list