Pessoal,
Tenho o seguinte código:
private void gifGenerator(Long[] logosId, long id) throws SQLException, IOException {
try {
DAO bannerDAO = DAOFactory.getDAOInstance(DAOFactory.BANNER_DAO);
ClientDAO cDAO = (ClientDAO) DAOFactory.getDAOInstance(DAOFactory.CLIENT_DAO);
ClientFilter clientFilter = new ClientFilter();
clientFilter.setId(id);
Client c = null;
List clientList;
try {
clientList = cDAO.searchObjects(clientFilter);
for (int i = 0; i < clientList.size(); i++) {
c = (Client) clientList.get(i);
}
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
//e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
//e1.printStackTrace();
}
String[] logoListDirName = null;
ResourceBundle bundle = ResourceBundle.getBundle("br.com.teste.www.dmd.aplic_config");
String gifGeneratorPath = bundle.getString("gifgenerator.path");
String rootDir = bundle.getString("rootDir.directory");
System.out.println("gifGeneratorPath: "+gifGeneratorPath);
File gifGenerator = new File(new File(gifGeneratorPath).getParent(), "GifGenerator.exe");
if(gifGenerator.exists()) {
String[] cmd = new String[7];
cmd[0] = gifGenerator.getAbsolutePath();
cmd[1] = " -t 1000";
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().getAbsolutePath();
System.out.println("logoListDirName[j]: "+logoListDirName[j]);
cmd[3] = " -f ";
if(j == (logosId.length - 1)) {
cmd[j+4] = logoListDirName[j];
} else {
cmd[j+4] = logoListDirName[j]+";";
}
k = j+5;
}
String logos = rootDir + File.separator + c.getLink() + File.separator + "logos.gif";
cmd[k] = " -o "+logos;
String comando = "cmd.exe /C start "+cmd[0]+cmd[1]+cmd[2]+cmd[3]+cmd[4]+cmd[5]+cmd[6];
System.out.println(comando);
Runtime.getRuntime().exec(comando);
} else {
//Log.warning("@PresentationRecorder#removeRMEventsFromFile(): rmevents.exe not found!");
}
} catch(Exception e) {
e.printStackTrace();
//Log.warning("Exception while trying to remove events from file", e);
}
Este print é o seguinte:
System.out.println(comando); = cmd.exe /C start C:\Documents and Settings\vlima\Desktop\teste\apache-tomcat-5.5
.20\webapps\business\WEB-INF\GifGenerator.exe -t 1000 -r 1 -f D:\helix_data\dmdw
eb\banners\moonwalk_20070301134957182.gif;D:\helix_data\dmdweb\banners\footprint
_20070301135004104.gif -o C:\Documents and Settings\vlima\Desktop\teste\apache-t
omcat-5.5.20\webapps\ROOT\testando\logos.gif
Quando eu coloco o GifGenerator.exe no C:, ele passa nessa parte, ams para quando tenta gerar o arquivo de saida por causa da pasta Documents and Settings.
Alguém pod eme ajudar?
