Pessoal,
Estou fazerndo um método para executar um arquivo.
Vejam se está correto o que estou fazendo:
private void gifGenerator(Long[] logosId) throws SQLException, IOException {
try {
DAO bannerDAO = DAOFactory.getDAOInstance(DAOFactory.BANNER_DAO);
String[] logoListDirName = null;
ResourceBundle bundle = ResourceBundle.getBundle("br.com.teste.www.dmd.aplic_config");
String gifGeneratorPath = bundle.getString("gifgenerator.path");
System.out.println("gifGeneratorPath: "+gifGeneratorPath);
File gifGenerator = new File(new File(gifGeneratorPath).getParent(), "GifGenerator.exe");
if(gifGenerator.exists()) {
String[] cmd = new String[50];
cmd[0] = gifGenerator.getAbsolutePath();
cmd[1] = " -t 1000ms";
cmd[2] = " -r 1";
int k = 0;
for(int j = 0; j < logosId.length; j++) {
logoListDirName = new String[logosId.length];
System.out.println("logosId[j]: "+logosId[j]);
Banner b = (Banner) bannerDAO.getObject(logosId[j]);
System.out.println("b.getBannerFile(): "+b.getBannerFile());
logoListDirName[j] = b.getBannerFile().toString();
System.out.println("logoListDirName[j]: "+logoListDirName[j]);
cmd[3] = " -f";
cmd[j+4] = " "+logoListDirName[j]+";";
k = j+5;
}
cmd[k] = " -o logos.gif";
//System.out.print("comando: "+cmd[0]+cmd[1]+cmd[2]+cmd[3]+cmd[4]+cmd[5]+cmd[6]+cmd[7]+cmd[8]+cmd[9]);
final Process fp = Runtime.getRuntime().exec(cmd);
new Thread() {
{
this.setDaemon(true);
}
}.start();
} else {
//Log.warning("@PresentationRecorder#removeRMEventsFromFile(): rmevents.exe not found!");
}
} catch(Exception e) {
//Log.warning("Exception while trying to remove events from file", e);
}
}
Aquele print do comando está assim:
comando: C:\Documents and Settings\vlima\Desktop\teste\apache-tomcat-5.5.20\weba
pps\business\WEB-INF\GifGenerator.exe -t 1000ms -r 1 -f D:\helix_data\dmdweb\ban
ners\cpqdlogo200_20070214104725876.jpg; D:\helix_data\dmdweb\banners\logo_cremes
p_20070214104755688.jpg; -o logos.gif
se eu fizer isso nmo terminal funciona.
Agora no java, falta eu fazer alguma coisa, pq não está gerando o arquivo logos.gif.
Obrigado.