[vtkusers] vtk installation CMake java problem

James Labiak jim at jslengineeringsoftware.com
Mon Nov 24 09:51:09 EST 2014


First, thanks for all of your help in getting VTK configured; I really 
appreciate it. I'm trying to document this well this in case other users 
find this thread. I think that my last question is how to run my 
application on other computers that don't have VTK installed (best 
method to make the libraries available on the other machines).

Maybe it wasn't necessary in my case to set the path in eclipse, because 
I got DemoJavaVTK.java working from
http://www.particleincell.com/blog/2011/vtk-java-visualization/
Maybe it is though in other cases or if I compiled it into a standalone 
program. I do have everything set in the Win 7 PATH and CLASSPATH env. 
variables.
However, Cone.java from the VTK Examples\Tutorial\Step1Java\Cone still 
gives the library errors. There is no dll called vtkCommonJava.dll in 
version 6.1.0, but it appears from older internet posts that maybe this 
file existed in a previous release of VTK (?). If I comment out the 
lines that try to load the following libraries
//  static {
//      System.out.println(System.getProperty("java.library.path"));
//    //System.loadLibrary("vtkCommonJava");
//    //System.loadLibrary("vtkFilteringJava");
//    //System.loadLibrary("vtkIOJava");
//    //System.loadLibrary("vtkImagingJava");
//    //System.loadLibrary("vtkGraphicsJava");
//    //System.loadLibrary("vtkRenderingJava");
//  }

then add a section to load all libraries

     static
     {
         if (!vtkNativeLibrary.LoadAllNativeLibraries())
     {
            for (vtkNativeLibrary lib : vtkNativeLibrary.values())
         {
                     if (!lib.IsLoaded())
                 System.out.println(lib.GetLibraryName() + " not loaded");
         }

         System.out.println("Make sure the search path is correct: ");
         System.out.println(System.getProperty("java.library.path"));
         }
         vtkNativeLibrary.DisableOutputWindow(null);
     }

Cone.java works correctly. Some other examples also appear to work 
correctly if I repeat the above to load all of the libraries.




On 11/21/2014 4:21 PM, Sebastien Jourdain wrote:
> Is your path properly available in Eclipse?
>
> Usually, I directly set it in Eclipse?
>
> DYLD_LIBRARY_PATH is similar to PATH on Mac.
>
> Inline image 1
>
> On Fri, Nov 21, 2014 at 1:35 PM, James Labiak 
> <jim at jslengineeringsoftware.com 
> <mailto:jim at jslengineeringsoftware.com>> wrote:
>
>     I believe that is what I have. PATH includes directory which
>     contains the dlls.
>
>
>
>
>
>     On 11/21/2014 2:19 PM, Sebastien Jourdain wrote:
>>     The PATH should point to the directory that contains the dll's,
>>     not the dll's themselves.
>>
>>
>>
>>     On Fri, Nov 21, 2014 at 12:07 PM, James Labiak
>>     <jim at jslengineeringsoftware.com
>>     <mailto:jim at jslengineeringsoftware.com>> wrote:
>>
>>         Hi Seb,
>>         I followed your directions, and now Eclipse gives the error
>>         "Exception in thread "main" java.lang.UnsatisfiedLinkError:
>>         no vtkCommonJava in java.library.path". I have set the Path
>>         to include the dll library, but there is no dll called
>>         vtkCommonJava.
>>         Jim
>>
>>
>>
>>         On 11/21/2014 10:45 AM, Sebastien Jourdain wrote:
>>>         Hi Jim,
>>>
>>>         The red mean, "New option available base on your previous
>>>         choice".
>>>         For the BUILD_SHARED_LIBS = OFF, I have quite some doubt.
>>>         That would mean you want a static build with the Java
>>>         wrapping. And to my knowledge, that is not possible with Java.
>>>
>>>         Otherwise, to have VTK works within the Eclipse development
>>>         environment, I usually need 2 things:
>>>         - Add the vtk.jar to the classpath of my project
>>>         - (on Windows) expend the PATH env var to add the directory
>>>         that contains all the dll of VTK. If you pick the option to
>>>         package VTK for Java, then you will need to unzip the native
>>>         JAR file and point to the content of its directory.
>>>
>>>         Seb
>>>
>>>         On Fri, Nov 21, 2014 at 7:31 AM, James Labiak
>>>         <jim at jslengineeringsoftware.com
>>>         <mailto:jim at jslengineeringsoftware.com>> wrote:
>>>
>>>             Hi Seb,
>>>             The JOGL and SWT were red, so I thought that I needed
>>>             them. I just want a standard installation that I can use
>>>             in Java with Eclipse, then be able to distribute a
>>>             program to another user. With them off, the installation
>>>             seemed to work but a sample java file cone.java showed
>>>             java path errors in Eclipse. I had set CLASSPATH sys var
>>>             to C:\vtk_jar\vtk.jar;C:\vtk_build\Wrapping\Java; and
>>>             included C:\Program Files\VTK\natives-Windows-AMD64 in
>>>             the PATH variable as well as
>>>             C:\jdk1.7.0_60\bin;C:\jdk1.7.0_60\jre\bin. From the VTK
>>>             user's guide, it sounds like I want an installation with
>>>             BUILD_SHARED_LIBS off for my distribution purpose. When
>>>             I do that, I get tons of errors in VS 2013. Am compiling
>>>             with 64 bit set in CMake. I'm not familiar with Maven,
>>>             and wasn't sure what to do with the binary distribution
>>>             files.
>>>             Thanks,
>>>             Jim
>>>
>>>
>>>
>>>             On 11/20/2014 11:03 AM, Sebastien Jourdain wrote:
>>>>             Hi James,
>>>>
>>>>             Please keep the thread on the mailing list so other
>>>>             community members could benefit from your question as well.
>>>>
>>>>             So first of all, why did you turn ON both
>>>>             VTK_JAVA_JOGL_COMPONENT and VTK_JAVA_SWT_COMPONENT?
>>>>
>>>>             Turning any of those option require that you have
>>>>             already the SWT native library or the JOGL library
>>>>             installed on your system. On top of that, none of them
>>>>             is required to have a VTK with Java Wrapping working.
>>>>
>>>>             In fact, you can probably just download the generated
>>>>             binaries from our VTK dashboard if you don't want to
>>>>             build VTK yourself here:
>>>>
>>>>             http://open.cdash.org/index.php?project=VTK&filtercount=1&field1=groupname/string&compare1=63&value1=Super-build
>>>>
>>>>             Then if you truly want to build VTK and have the JOGL
>>>>             rendering classes available on top of the default ones,
>>>>             then the best approach is to get them using Maven. And
>>>>             you should make sure you provide the path to the proper
>>>>             jar inside your CMake config. (You may need to toggle
>>>>             the advance mode to see them).
>>>>
>>>>             Seb
>>>>
>>>>
>>>>                 On Thu, Nov 20, 2014 at 8:49 AM, James Labiak
>>>>                 <jim at jslengineeringsoftware.com
>>>>                 <mailto:jim at jslengineeringsoftware.com>> wrote:
>>>>
>>>>                     Hi Seb,
>>>>                     Thanks for picking up on this. I put images of
>>>>                     the CMake process below, also the JOGL source
>>>>                     directory files and the JOGL build directory
>>>>                     files. Here are some errors that VS 2013 gives,
>>>>                     which is how I noticed that the JOGL classes
>>>>                     were missing from the build directory
>>>>                     structure. If I should be placing JOGL jar
>>>>                     files somewhere, then I'm not sure where to put
>>>>                     it(them).
>>>>                     Thanks,
>>>>                     Jim
>>>>
>>>>                     386>CUSTOMBUILD : warning : [options] bootstrap
>>>>                     class path not set in conjunction with -source 1.5
>>>>                     386>
>>>>                     C:\vtk_build\java\vtk\rendering\jogl\vtkAbstractJoglComponent.java:3:
>>>>                     error: package javax.media.opengl does not exist
>>>>                     386> import javax.media.opengl.GLAutoDrawable;
>>>>
>>>>                     386>
>>>>                     C:\vtk_build\java\vtk\rendering\jogl\vtkJoglPanelComponent.java:5:
>>>>                     error: package javax.media.opengl.awt does not
>>>>                     exist
>>>>                     386> import javax.media.opengl.awt.GLJPanel;
>>>>
>>>>                     387>
>>>>                     C:\vtk_build\java\vtk\rendering\jogl\vtkJoglCanvasComponent.java:20:
>>>>                     error: cannot find symbol
>>>>                     387> public
>>>>                     vtkJoglCanvasComponent(vtkRenderWindow
>>>>                     renderWindow, GLCapabilities capabilities) {
>>>>                     387> ^
>>>>                     387> symbol: class GLCapabilities
>>>>                     387> location: class vtkJoglCanvasComponent
>>>>                     387>
>>>>                     C:\vtk_build\java\vtk\rendering\jogl\vtkJoglPanelComponent.java:3:
>>>>                     error: package javax.media.opengl does not exist
>>>>                     387> import javax.media.opengl.GLCapabilities;
>>>>
>>>>
>>>>
>>>>
>>>>                     On 11/19/2014 2:38 PM, Sebastien Jourdain wrote:
>>>>>                     Hi James,
>>>>>
>>>>>                     What do you mean by JOGL classes? Are you
>>>>>                     talking about the JOGL jar files?
>>>>>                     What did you change in your CMake
>>>>>                     configuration step?
>>>>>
>>>>>                     Seb
>>>>>
>>>>>                     On Wed, Nov 19, 2014 at 8:40 AM, James Labiak
>>>>>                     <jim at jslengineeringsoftware.com
>>>>>                     <mailto:jim at jslengineeringsoftware.com>> wrote:
>>>>>
>>>>>                         Hello,
>>>>>                         I am trying to install vtk with Java
>>>>>                         wrapping. When I build in VS 2013, I get
>>>>>                         errors related to jogl classes not being
>>>>>                         found. I placed the missing classes java
>>>>>                         files in the vtk\rendering\jogl
>>>>>                         directories as necessary, but after CMake
>>>>>                         Configure and Generate steps, the jogl
>>>>>                         files are not being copied to the build
>>>>>                         directory Java\rendering\jogl directory
>>>>>                         and so I get the same errors upon build in
>>>>>                         VS 2013.
>>>>>                         Thanks,
>>>>>
>>>>
>>>>>                         _______________________________________________
>>>>>                         Powered by www.kitware.com
>>>>>                         <http://www.kitware.com>
>>>>>
>>>>>                         Visit other Kitware open-source projects
>>>>>                         at
>>>>>                         http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>>                         Please keep messages on-topic and check
>>>>>                         the VTK FAQ at:
>>>>>                         http://www.vtk.org/Wiki/VTK_FAQ
>>>>>
>>>>>                         Follow this link to subscribe/unsubscribe:
>>>>>                         http://public.kitware.com/mailman/listinfo/vtkusers
>>>>>
>>>>>
>>>
>>>
>>
>>         -- 
>>         James Labiak
>>         JSL Engineering and Software
>>         6545 Lainhart Rd.
>>         Altamont, NY 12009
>>         Phone:518-861-1113  <tel:518-861-1113>
>>         Mobile:231-638-3725  <tel:231-638-3725>
>>         email:jim at jslengineeringsoftware.com  <mailto:jim at jslengineeringsoftware.com>
>>
>>
>
>     -- 
>     James Labiak
>     JSL Engineering and Software
>     6545 Lainhart Rd.
>     Altamont, NY 12009
>     Phone:518-861-1113  <tel:518-861-1113>
>     Mobile:231-638-3725  <tel:231-638-3725>
>     email:jim at jslengineeringsoftware.com  <mailto:jim at jslengineeringsoftware.com>
>
>

-- 
James Labiak
JSL Engineering and Software
6545 Lainhart Rd.
Altamont, NY 12009
Phone: 518-861-1113
Mobile: 231-638-3725
email: jim at jslengineeringsoftware.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141124/52c537fa/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 123741 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141124/52c537fa/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 1119 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141124/52c537fa/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 22288 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141124/52c537fa/attachment-0005.png>


More information about the vtkusers mailing list