…
Process proc = Runtime.getRuntime().exec(commands);
…
Variable commands
[/bin/sh, -c, convert -density 125 -threshold 46% "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1499126559/1_splitted.pdf" +adjoin "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1499126559/1_splitted.pdf_B.gif"]
Error: /invalidfont in /findfontOperand stack: –dict:6/6(L)– F10 8 –dict:9/9(L)– –dict:9/9(L)– TimesNewRomanPSMT –dict:9/9(L)– Times-Roman Times-RomanExecution stack: %interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push –nostringval– –nostringval– –nostringval– false 1 %stopped_push 1797 1 3 %oparray_pop 1796 1 3 %oparray_pop 1792 1 3 %oparray_pop –nostringval– –nostringval– 2 1 1 –nostringval– %for_pos_int_continue –nostringval– –nostringval– –nostringval– –nostringval– %array_continue –nostringval– false 1 %stopped_push –nostringval– %loop_continue –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– 1767 9 9 %oparray_popDictionary stack: –dict:1086/1123(ro)(G)– –dict:2/20(G)– –dict:74/200(L)– –dict:74/200(L)– –dict:105/127(ro)(G)– –dict:259/300(ro)(G)– –dict:21/25(L)– –dict:4/6(L)– –dict:24/31(L)–Current allocation mode is localLast OS error: 2
GPL Ghostscript 8.56: Unrecoverable error, exit code 1.convert.bin: Postscript delegate failed `/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1453127511/1_splitted.pdf': No such file or directory @ pdf.c/ReadPDFImage/612..convert.bin: missing an image filename `/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1453127511/1_splitted.pdf_A.gif' @ convert.c/ConvertImageCommand/2775.
390
0
0
[/bin/sh, -c, /usr/local/bin/zbarimg -q -Sdis -Sqrcode.en "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit45676289/0_splitted.pdf_A.gif"]
zbarimg: magick/cache.c:647: AcquireOnePixelFromCache: Assertion `image != (Image *) ((void *)0)' failed.
[root@ged1 runexec]#/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
class Run {
public final static String OS_NAME = System.getProperty("os.name");
public final static String LINUX = "linux";
public final static String WINDOWS = "windows";
public static void main (String[] args){
System.out.println("Start…");
String command = "/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif";
executeCommand(command,true,false);
}
public static boolean executeCommand(String command, boolean waitFor,
boolean disableDirectOutputError) {
BufferedReader stdInput = null;
BufferedReader stdError = null;
boolean returnSuccess = true;
try {
String[] commands = new String[3];
// Depending of the OS
if ((OS_NAME.toLowerCase()).indexOf("windows") >= 0) {
// Windows
commands[0] = "cmd.exe";
commands[1] = "/C";
} else if ((OS_NAME.toLowerCase()).indexOf("linux") >= 0) {
// Linux
commands[0] = "/bin/sh";
commands[1] = "-c";
// Les programmes sont dans /usr/local/bin/
//commands[2]="/usr/local/bin/";
} else {
System.out.println("Not configurate to run external commands on : "
+ OS_NAME);
return false;
}
// Add the command to execute
commands[2] = command;
String infoMessage = "";
for (String cmd : commands) {
infoMessage += cmd + ";";
}
System.out.println("Run the external commands : '" + infoMessage
+ "' and waitFor : " + waitFor);
Process proc = Runtime.getRuntime().exec(commands);
stdInput = new BufferedReader(new InputStreamReader(
proc.getInputStream()));
stdError = new BufferedReader(new InputStreamReader(
proc.getErrorStream()));
// Wait
if (waitFor) {
System.out.println("Wait for…");
proc.waitFor();
System.out.println("End of external process");
}
//
// Outputs
//
String outputLine = null;
String output = "";
String outputError = "";
while ((outputLine = stdInput.readLine()) != null) {
output += outputLine;
}
// Output error
while ((outputLine = stdError.readLine()) != null) {
outputError += outputLine;
}
// Write outputs
if (output != null && output.length() > 0) {
System.out.println(output);
//if (outputMessage != null) {
// outputMessage.message = output;
//}
}
if (outputError != null && outputError.length() > 0) {
if (!disableDirectOutputError) {
System.out.println(outputError);
}
//if (outputMessage != null) {
// outputMessage.messageError = output;
//}
returnSuccess = false;
}
} catch (Exception e) {
System.out.println("Error trying using the external command");
return false;
} finally {
// Close
try {
if (stdInput != null) {
stdInput.close();
}
} catch (Exception e) {
System.out.println("Error trying closing flux");
returnSuccess = false;
}
try {
if (stdError != null) {
stdError.close();
}
} catch (Exception e) {
System.out.println("Error trying closing flux");
returnSuccess = false;
}
}
return returnSuccess;
}
}
commands[2]="/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif";
…
Process proc = Runtime.getRuntime().exec(commands);
…
Info erreur (stdError)
sh: -c: line 0: syntax error near unexpected token `&'sh: -c: line 0: `"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/tmp/magick-XXk5sZ0E" "-f/tmp/magick-XXND5eN3" "-f/tmp/magick-XXmbSlAs"'convert: Postscript delegate failed `/media/lienVersPartage/test/runexec/im.pdf': No such file or directory.convert: missing an image filename `/media/lienVersPartage/test/runexec/im.pdf.gif'.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.