I need to execute an nconvert.exe file using
java program.The Process class here converting all images format present in ok folder and show it in .bmp format in out folder
this is the code that i wrote :
import java.io.*;
public class Test3 {
public static void main(
String[] args) {
Runtime run = Runtime.getRuntime();
try {
Process pp=run.exec("C://convert//nconvert -out png -o
c://out1//%%.png c://ok//*%.*%");
BufferedReader in =new BufferedReader(new InputStreamReader(pp.getErrorStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
int exitVal = pp.waitFor();
System.out.println("Process exitValue: " + exitVal);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}
when i try 2 run this code:
here i am getting this sort of error:
java.io.IOException: CreateProcess: C:\convert\nconvert -out png -o
c://out1//%% .png
c://ok//*%.*% error=193
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)
at Test3.main(Test3.java:8)
CreateProcess: C:\convert\nconvert -out png -o
c://out1//%%.png c://ok//*%.*% error=193
pls help me in this issue.