Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » PLZ REPLY: JNI does NOT work under workbench!
PLZ REPLY: JNI does NOT work under workbench! [message #445375] Thu, 04 November 2004 15:10 Go to next message
Auerliano is currently offline AuerlianoFriend
Messages: 149
Registered: July 2009
Senior Member
Applying JNI (eg calling a c++ dll) to a java application using eclipse
works fine. But when the project is run as an eclipse workbench it doesn't
do anything. The worse thing is that the eclipse debugger is of no help to
trace the bug. Could it be possible that the eclipse class loader doesn't
work properly for JNI applications?

On the other hand, I understand that SWT uses JNI for the native look'n
feel. Seems I am missing something in running JNI under the workbench (or
generally RCP) mode. Any help is greatly appreciated!

-----------
In supporting my argument I refer you to an unsuccessful attempt of
importing the imagemagick C/C++ library via jmagick.jar to the eclipse
workbench:

http://coding.derkeiler.com/Archive/Java/comp.lang.java.prog rammer/2004-02/0247.html
Re: PLZ REPLY: JNI does NOT work under workbench! [message #445394 is a reply to message #445375] Thu, 04 November 2004 22:09 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Open a dos terminal:

set PATH=C:\Program Files\ImageMagick-5.5.7-Q8;%PATH%
eclipse

should work

Chris
Re: PLZ REPLY: JNI does NOT work under workbench! [message #445396 is a reply to message #445394] Thu, 04 November 2004 23:29 Go to previous message
Auerliano is currently offline AuerlianoFriend
Messages: 149
Registered: July 2009
Senior Member
Chris,

The ImageMagick installer already puts the binary directory in the system
path. I have tried putting the dll's in different directories in the path
including windows\system32 and no luck!

Just try to run this minimal code as a java application in eclipse:

-----------------------------------------------
// Test.java
import magick.*;

public class Test {
static {
System.loadLibrary("JMagick");
}

public static void main(String[] args) throws MagickException {
ImageInfo info = new ImageInfo("c:/test/input.jpg");
}
}
// End of Test.java
-----------------------------------------------

This gives:
-----------------------------------------------
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JMagick in
java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at magick.MagickLoader.<clinit>(MagickLoader.java:13)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow n Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un known
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at magick.Magick.<clinit>(Magick.java:21)
at Test.main(Test.java:23)
-----------------------------------------------

Now this 'no JMagick in java.library.path' is driving me crazy!!
JMagick.jar, JMagick.dll and all the C-dll's *ARE* in a path in
'java.library.path'. I have verified it by
System.getroperty("java.library.path). What am I missing here? Do I have
to declare any native methods that I use in the java file? That is, if I,
say, use 'ImageInfo' function I have to declare something like:

public native void[?] ImageInfo(String arg0)

Thanks for the help.


Christophe Cornu wrote:

> Open a dos terminal:

> set PATH=C:Program FilesImageMagick-5.5.7-Q8;%PATH%
> eclipse

> should work

> Chris
Previous Topic:Screen capture and Menus
Next Topic:Why StyledText dose not word-wrap in SWT3.0
Goto Forum:
  


Current Time: Thu Apr 25 17:52:18 GMT 2024

Powered by FUDForum. Page generated in 0.03122 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top