Java: Eteindre un ordinateur

Author:

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

public class EteindrePC
{
	/*
	 * Le programme éteint 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.exe -s -t 0";
              }

        // Sous Linux ou Mac
        else if (operatingSystem.startsWith("Linux") || operatingSystem.startsWith("Mac OS X"))
             {
              commande = "shutdown -h now";
              }

            else
             {
        throw new RuntimeException("Impossible d'éteindre ce PC");
             }

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


		 }
}

A Voir sur le même Sujet:

  • java éteindre un pc
  • etindre un pc code java
  • commande java etaindre l'ordinateur
  • java eteindre l'ordinateur
  • program java qui eteind un pc
  • eteindre un ordinateur avec JAVA
  • eteindre un ordinateur en accès public
  • socket java arreter ordinateur
  • java eteindre le pc
  • éteindre l'ordinateur java

Leave a Reply

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