need to start PHP , APACHE , MYSQL using UWAMP or any as Background process without showing tray icon or any ? using command line start -WindowStyle Hidden its not working. kindly suggest me something for this.
Asked
Active
Viewed 978 times
1 Answers
0
use the commands prompt to start the application in the windows, almost all programming language is able of use this recurse, I'm use in java language with these commands:
//class for use the commands in the prompt of the windows OS
public class Prompt {
public static String exec(String cmd) {
String resposta = "";
try {
Scanner S = new Scanner(Runtime.getRuntime().exec(cmd).getInputStream());
while (S.hasNextLine()) {
resposta += S.nextLine() + "\n";
}
} catch (Exception ex) {
Alert.error(ex.getMessage());
}
return resposta;
}
public static void open(String cmd) {
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException ex) {
Alert.error(ex.getMessage());
}
} }
// method in another class for start programs like a service
public static void start() {
try {
String file = new File("").getAbsolutePath();
String startApache = file + "/UwAmp/bin/apache/bin/httpd.exe -k -start";
String startMySql = file + "/UwAmp/bin/database/mysql-5.7.11/bin/mysqld.exe";
System.out.println("beginning Apache Server");
Prompt.exec(startApache);
Thread.sleep(500);
System.out.println("beginning MySQL Database Server");
Prompt.exec(startMySql);
Thread.sleep(500);
} catch (Exception ex) {
Alert.error(ex.getMessage());
}
}