I\'m running some code in Java on Ubuntu 12.04 LTS 64 Bit (with Gnome Shell), using Oracle JDK 1.8.0_05 via NetBeans8.0.
The following function works perfectly when
I resolved problem with...
public static void abrirArquivo(File arquivo) {
if (arquivo != null) {
if (arquivo.exists()) {
OpenFile openFile = new OpenFile(arquivo);
Thread threadOpenFile = new Thread(openFile);
threadOpenFile.start();
}
}
}
private static class OpenFile implements Runnable {
private File arquivo;
public OpenFile(File arquivo) {
this.arquivo = arquivo;
}
private void abrirArquivo(File arquivo) throws IOException {
if (arquivo != null) {
java.awt.Desktop.getDesktop().open(arquivo);
}
}
@Override
public void run() {
// TODO Auto-generated method stub
try {
abrirArquivo(arquivo);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}