aspose file tools*
The moose likes Servlets and the fly likes no JMagick in java.library.path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "no JMagick in java.library.path" Watch "no JMagick in java.library.path" New topic
Author

no JMagick in java.library.path

Cai Haihui
Greenhorn

Joined: Dec 04, 2006
Posts: 3
Hi!
First,I'm sorry my English is not well.
My code can run at the APP,but can not run at the jsp web,I have add the code to front of all code: System.setProperty("jmagick.systemclassloader","no");
Thank for your any help!!
=================================================================
The error
-->
java.lang.UnsatisfiedLinkError: no JMagick in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at magick.Magick.<clinit>(Magick.java:38)
at tools.Image.createImage(Image.java:13)
at servlets.JMagick.doGet(JMagick.java:15)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
at java.lang.Thread.run(Thread.java:595)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41525
    
  53
Hello "cai hhx"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, where did you put the native libraries that come with JMagick? They need to be in a directory that's part of java.library.path, and apparently are not.


Ping & DNS - my free Android networking tools app
Cai Haihui
Greenhorn

Joined: Dec 04, 2006
Posts: 3
Thank you very much.
I already updated my data,this name is my true name,is it ok?
about my question,my OS is WinXP,I sure,I already set the ImageMagick install folder to classpath,and copy all dll files to system folder,and copy the "jmagick.jar" to webapps\WEB-INF\lib.

my test code is -->
------------------------------------------------------------------------
//This is a Servlet
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import magick.ImageInfo;
import magick.MagickApiException;
import magick.MagickException;
import magick.MagickImage;

public class JMagick extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
System.setProperty("jmagick.systemclassloader","no");
ImageInfo info = new ImageInfo("E:\\temp.jpg");
MagickImage image = new MagickImage(info);
int scalex = 200;
int scaley = 168;
image = image.scaleImage(scalex,scaley);
image = image.sharpenImage(1.0, 5.0);
image.setFileName("E:\\temp_2.jpg");
info = new ImageInfo();
image.writeImage(info);
image.destroyImages();
response.getWriter().write("success!");
} catch (MagickApiException e) {
response.getWriter().write("failure_1!");
} catch(MagickException ex) {
response.getWriter().write("failure_2!");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41525
    
  53
Thanks for changing the name, it's fine now.

I already set the ImageMagick install folder to classpath

That probably makes no difference because you already have the jar file in the correct place.

,and copy all dll files to system folder

The DLLs need to be in a directory that's part of java.library.path (which is not the same thing as the classpath). The value of java.library.path is available as a system property, so check its value to see if it includes the directory where you put the DLLs.
Cai Haihui
Greenhorn

Joined: Dec 04, 2006
Posts: 3
Hello!Ulf Dittmer,Thanks for your reply.
I solved the problem lastly,I am very rejoice.
The integrant file "jmagick.dll" need to work in that folder "JDK\jre\bin",it's different from universal use description.
Thank you,I like JavaRanch!
Oh,my English is so bad.
[ December 06, 2006: Message edited by: Cai Haihui ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: no JMagick in java.library.path