Java: Redémarrer un Ordinateur

Author:

 int,string,char,static, url, socket, url, socket, java
{filelink=23}

public class RedemarrerPC
{
	/*
	 * Le programme Redémarre le PC automatiquement
	 */
	public static void main (String[] args) throws Exception
		{
			    String commande;
            String operatingSystem = System.getProperty("os.name");
           System.out.println(operatingSystem);
        // Sous Windows
        if (operatingSystem.startsWith("Windows"))
              {
        commande = "shutdown -r";
              }

        // Sous Linux
        else if (operatingSystem.startsWith("Linux"))
             {
              commande = "reboot";
              }
           // Sous Mac
        else if (operatingSystem.startsWith("Mac OS"))
             {
              commande = "shutdown -r now";
              }
            else
             {
        throw new RuntimeException("Impossible de redémarrer cet ordinateur");
           return;
             }

          Runtime.getRuntime().exec(commande);
          System.exit(0);


		 }
}

A Voir sur le même Sujet:

  • demarrer un pc en java
  • redémarrer ordi main
  • java fait rebooter
  • java redémarrer ordinateur
  • redémarrer pc en java
  • java ordinateur
  • faire rédémarrer ordinateur en java
  • java redémarrer pc

Leave a Reply

Your email address will not be published. Required fields are marked *