On Tue, Jun 21, 2011 at 8:00 PM, Antonio Recio <[email protected]> wrote:
> I have tried to use wall-hack-method but I still obtain the
> error: UnsatisfiedLinkError vtk.vtkConeSource.VTKInit()J
> vtk.vtkConeSource.VTKInit (vtkConeSource.java:-2). What I am doing wrong?
> (ns project.core
> (:import (javax.swing JButton JFrame JPanel)
> (vtk vtkConeSource vtkPolyDataMapper vtkRenderWindow
> vtkRenderWindowInteractor vtkCamera vtkActor vtkRenderer
> vtkInteractorStyleTrackballCamera)))
> (System/loadLibrary "vtkCommonJava")
> (System/loadLibrary "vtkFilteringJava")
> (System/loadLibrary "vtkIOJava")
> (System/loadLibrary "vtkImagingJava")
> (System/loadLibrary "vtkGraphicsJava")
> (System/loadLibrary "vtkRenderingJava")
You need to replace all of these with the appropriate (load-lib
vtkConeSource "libraryName"). The vtkConeSource there is fairly
arbitrary, it's just any class that was loaded by the correct
ClassLoader.
> (defn wall-hack-method
> [class-name method-name params obj & args]
> (-> class-name (.getDeclaredMethod (name method-name) (into-array Class
> params))
> (doto (.setAccessible true))
> (.invoke obj (into-array Object args))))
> (defn load-lib [class vtk]
> (wall-hack-method java.lang.Runtime "vtkCommonJava" [Class String]
Where did this "vtkCommonJava" come from? It must be "loadLibrary0".
You're trying to call a method that doesn't exist.
To be clear, the top of your file should look like:
(defn wall-hack-method
"Calls a private or protected method.
params is a vector of class which correspond to the arguments to the method
obj is nil for static methods, the instance object otherwise
the method name is given as a symbol or a keyword (something Named)"
[class-name method-name params obj & args]
(-> class-name (.getDeclaredMethod (name method-name) (into-array
Class params))
(doto (.setAccessible true))
(.invoke obj (into-array Object args))))
(defn load-lib [class lib]
"Loads a native library in the same classLoader as class was
loaded in, lib is a string with the OS-appropriate name of the
library. For instance, to load libvtk.so on Linux, lib should be
\"vtk\""
(wall-hack-method java.lang.Runtime "loadLibrary0" [Class String]
(Runtime/getRuntime) class lib))
(load-lib vtkConeSource "vtkCommonJava")
(load-lib vtkConeSource "vtkFilteringJava")
(load-lib vtkConeSource "vtkIOJava")
(load-lib vtkConeSource "vtkImagingJava")
(load-lib vtkConeSource "vtkGraphicsJava")
(load-lib vtkConeSource "vtkRenderingJava")
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en