I want to run an exe file in my project.
I mean when I run my codes,a specific executable file run.
How can I do that?

Google Java ProcessBuilder for examples and tutorials

I want to run an exe file in my project.
I mean when I run my codes,a specific executable file run.
How can I do that?

you could also look at using a Runtime class of java:

import java.io.*;  
public class TestExec {  
    public static void main(String[] args) {  
        try {  
            Process p = Runtime.getRuntime().exec("cmd echo Hello World");  //calls cmd.exe and prints hello world to console
            BufferedReader in = new BufferedReader(  
                                new InputStreamReader(p.getInputStream()));  
            String line = null;  
            while ((line = in.readLine()) != null) {  
                System.out.println(line);  
            }  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  
}
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.