I'm working on a packet analyser program and have encountered some issues:
- I want to open an exe file that would capture packets and write to another file.
- I want to open it in elevated mode.
I have written somewhat :
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import javax.swing.JOptionPane;
public class Options extends javax.swing.JFrame {
private void recActionPerformed(java.awt.event.ActionEvent evt) {
if (Desktop.isDesktopSupported()) {
try {
File myFile = new File(
"C:\\Users\\HP\\Documents\\response\\Server_Analyser\\src\\server_analyser\\serverdump\\reader.exe");
Desktop.getDesktop().open(myFile);
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Sorry cannot find desired file !");
}
}
}
}