desktop - how to set an alarm in java -


i'm trying use java open default web browser youtube video @ specific time enter program (to make alarm of sorts)

here's code:

import java.awt.desktop; import java.net.uri; import java.net.urisyntaxexception; import java.io.ioexception;   public class ytalarm {     int hr;     int min;     public ytalarm(int hours, int minutes) //constructor      {         hr = hours;         min = minutes;     }      public static void main (string [] args) throws urisyntaxexception, ioexception //main method     {          string url = "https://www.youtube.com"; //link open once alarm goes off           ytalarm ytalarm = new ytalarm(15, 20); //sets alarm go off @ 3:20 pm          long alarm1 = ytalarm.converttimetomilli(); //converts alarm time ms           //checks time on each itteration , once alarm1== curent time, opens yt video         {              if (system.currenttimemillis() == alarm1)              {                 if (desktop.isdesktopsupported())                 {                      desktop.getdesktop().browse(new uri(url));                 }              }          }           while (system.currenttimemillis()!= time);      }      public long converttimetomilli() //method convert alarm time hours , minutes ms     {          long milli = (60000*min) + (3600000*hr);          return milli;     } } 

this code compiles no errors doesn't function properly. doesn't open link have entered when current time matches time entered constructor. know how can change code functions way intend to?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -