2012-07-08 2 views
0

im4j 래퍼를 사용하여 작성된 사진 클라이언트 프로그램에서 ImageMajick을 호출하여 사진을 처리했습니다. 우리는 맥 OSX에서 실행하면 설치하지만, 윈도우 OS에서 잘 실행, 우리는 다음과 같은 예외를Mac OSX의 im4j 명령을 실행할 수 없습니다.

org.im4java.core.InfoException: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": error=2, No such file or directory 
    at org.im4java.core.Info.getBaseInfo(Info.java:201) 
    at org.im4java.core.Info.<init>(Info.java:96) 
    at tenw.photos.ImageTransformer.getImageInfo(ImageTransformer.java:474) 
    at tenw.photos.ImageTransformer.getCenterCoordinates(ImageTransformer.java:517) 
    at tenw.photos.ImageTransformer.cropCenter(ImageTransformer.java:157) 
    at tenw.photos.ImageTransformerTest.testCropCenter(ImageTransformerTest.java:32) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at junit.framework.TestCase.runTest(TestCase.java:154) 
    at junit.framework.TestCase.runBare(TestCase.java:127) 
    at junit.framework.TestResult$1.protect(TestResult.java:106) 
    at junit.framework.TestResult.runProtected(TestResult.java:124) 
    at junit.framework.TestResult.run(TestResult.java:109) 
    at junit.framework.TestCase.run(TestCase.java:118) 
    at junit.framework.TestSuite.runTest(TestSuite.java:208) 
    at junit.framework.TestSuite.run(TestSuite.java:203) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:96) 
    at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:117) 
    at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:94) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) 
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) 
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) 
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) 
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) 
Caused by: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": error=2, No such file or directory 
    at org.im4java.core.ImageCommand.run(ImageCommand.java:215) 
    at org.im4java.core.Info.getBaseInfo(Info.java:189) 
    ... 33 more 
Caused by: java.io.IOException: Cannot run program "identify": error=2, No such file or directory 
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) 
    at org.im4java.process.ProcessStarter.startProcess(ProcessStarter.java:407) 
    at org.im4java.process.ProcessStarter.run(ProcessStarter.java:312) 
    at org.im4java.core.ImageCommand.run(ImageCommand.java:211) 
    ... 34 more 
Caused by: java.io.IOException: error=2, No such file or directory 
    at java.lang.UNIXProcess.forkAndExec(Native Method) 
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:53) 
    at java.lang.ProcessImpl.start(ProcessImpl.java:91) 
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:453) 

명령을 받고 계속하는 PATH 변수에서 찾을 수 있습니다 확인합니다. 동일한 명령이 셸에서 실행되면 제대로 작동합니다. 어떤 도움을 많이 주셨습니다.

답변

0

eclipse의 환경 변수 설정에서 내 설정 경로 변수가 작동합니다. 어떤 사람은 JVM이 명령을 실행하기 전에 경로 변수를 선택할 수없는 이유에 대한 답을 향상시킬 수 있습니다.

+0

나는 또한 같은 문제에 직면하고 있습니다. Eclipse 환경 변수에 정확히 무엇을 추가했는지 말해 주시겠습니까? – tuk

관련 문제