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.
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.