Caros,
se eu rodar esse código diretamente do Eclipse,tudo funciona ok.No entanto,se eu empacotar a classe num .jar e executar,o metodo copiar() parece não estar sendo chamado.Já assinei o jar.O que pode estar errado?
public void actionPerformed(ActionEvent e)
{
JComponent c = (JComponent) e.getSource();
if (c == capture)
{
String nomeFoto = JOptionPane.showInputDialog("Número do Documento");
// Grab a frame
FrameGrabbingControl fgc = (FrameGrabbingControl)
player.getControl("javax.media.control.FrameGrabbingControl");
buf = fgc.grabFrame();
// Convert it to an image
btoi = new BufferToImage((VideoFormat)buf.getFormat());
img = btoi.createImage(buf);
// show the image
imgpanel.setImage(img);
File dir = new File("c://fotosSTDS//");
if(!dir.exists())dir.mkdir();
String caminhoArquivo = "c://fotosSTDS//"+nomeFoto+".jpg";
// save image
saveJPG(img,caminhoArquivo);
File origem = new File(caminhoArquivo);
File destino = new File("C://Arquivos de programas//Tomcat 6.0//fotosSTDS");
//File destino = new File("//venus//E$//Tomcat6//fotosSTDS");
try {
copiar(origem,destino);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
public static void copiar(File origem,File destino) throws IOException{
FileUtils.copyFileToDirectory( origem, destino );
}