I have the simple batch file code, which is working:
set path=%path%;C:\Program Files (x86)\Java\jdk1.7.0_05\bin
javac C:\Users\Ian\Desktop\batchFileTest\GUI.java
java -splash:images/splashImage.jpg GUI
However, it only takes like 1 second for my GUI class-file to load, and then the splash-screen immediately closes and launches the program.
I want to make the splash-screen wait for 5 seconds. My idea was to first execute the splash-screen without the class-file, to use TIMEOUT
, and then to execute the class-file like this:
set path=%path%;C:\Program Files (x86)\Java\jdk1.7.0_05\bin
javac C:\Users\Ian\Desktop\batchFileTest\GUI.java
java -splash:images/splashImage.jpg
TIMEOUT 5
java GUI
This isn't working correctly either. The splash-screen is then displayed for some milliseconds and is closed immediately. The command-line then waits for 5 seconds, and then the program is launched.
Any ideas on how to correctly do this from a batch file?
Thanks to Greg here, I have a solution where I am delaying the splash-screen from the main method using Thread.sleep
.
class GUI {
public static void main(String[] args) {
try {
Thread.sleep(5000); // the parameter is in milliseconds
catch(InterruptedException e) {
System.out.println(e.getMessage());
}
/*
* do whatever stuff here
*/
}
} // end of GUI
...and here is the class with the main method:
class GUI { public static void main(String[] args) { try { Thread.sleep(5000); // the parameter is in milliseconds catch(InterruptedException e) { System.out.println(e.getMessage()); } /* * do whatever stuff here */ } } // end of GUI
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.