• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

no JMagick in java.library.path

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cai Haihui
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!