So I need to get up early tomorrow, and my alarm clock is broken, and my phone isn't too reliable. Ive turned to java for the solution. I've created a little script which i hope will get me up. I do plan to have my computer on overnight, and I plan to do so with max volume on speakers, but im still not sure if Thread can handle such a long time. Which, according to python, is up to 28800000 milliseconds (if my math is correct). The Runtime.exec() will work, i've tested that.
Please check this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public class Wake extends Thread {
int hours = 6; public static void main(String[] args){ new Wake().start(); } public void run(){ try{ System.out.println("Starting..."); Thread.sleep(hours*60*60*1000); Runtime runtime = Runtime.getRuntime(); runtime.exec("firefox http://www.youtube.com/watch?v=y7tI1E6kp0o"); }catch(Exception e){ e.printStackTrace(); } } } |
Thanks.