I'm trying to launch an .exe from a JButton on a java Jframe, any1 knows how to make it execute.

private void OKButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }

Recommended Answers

All 4 Replies

Look at the ProcessBuilder class

Try this..

Desktop d=Desktop.getDesktop();
d.open("c:\\myapplication.exe");

Check the API doc for the args to open(). Mine doesn't take a String.

yaa ur right that was a unnoticed mistake..

File f=new File("c:\\myapplication.exe");
Desktop d=Desktop.getDesktop();
d.open(f);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.