How to shutdown a pc with java??

Please I need to know how to shutdown a pc with a java program.

(I don't think Windows has one built in, but Icould be wrong), or JNI.
http://www.google.ie/search?hl=en&q=How+to+shutdown+pc
fromcommand+line&btnG=Google+Search&meta=
First link ;)Ahh, Learn something new every day, that be new in XP. Alas I don't use XP.

Similar Messages

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • How can i create messenger with java tv API on STB

    deal all.
    how can i create messenger with java tv API on STB.
    how can Xlets communicate each other?
    how?
    i am interested in xlet communications with java tv.
    is it impossible or not?
    help all..

    You can create a messenger-style application using JavaTV fairly easily. JavaTV supports standard java.net, and so any IP-based connection is pretty easy to do. The hard part of the application will be text input, but people have been using cellphone keypads to send SMS messages for long enough that they're familiar with doing this. This doesn't work well for long messages, where you really need a decent keyboard, but for short SMS-type messages it's acceptable.
    The biggest problem that you need to work around is the return channel. Many receivers only have a dial-up connection, ties up the phone line and potentially costs people money if they don't get free local calls. Always-on return channels (e.g. ADSL or cable modem) are still pretty uncommon, so it's something that you nee to think about. Of course, if you do have an always-on connection then this problem just goes away.
    This is really one of those cases that's technically do-able, but the infrastructure may not be there to give users a good experience.
    Steve.

  • How to program a screensaver with java???

    Hi all,
    Can someone tell em how to program a screensaver with java, and how should i begin ? or maybe someone know any useful information source?
    thanks a lot.
    ck

    A quick google search gives me, among lots of other things:
    http://kevinkelley.mystarband.net/java/sava.html
    Good luck
    Lee

  • How to share a folder with java? in netbios in windows

    hi. I want to write a programa that user can select a directory than
    click the share button and the directory will be shared to other pcs.
    the other pcs can acces this directory like \\servername\shareddirectory
    the question is this. how can i share a director with java or JNI's?
    please help me.
    with my best regards....

    thanks about net share command.
    i know how to use Runtime.getRuntime.exec()
    but i cont find the syntax of net share command.
    can u give an example? i use net help share and i try different
    sytaxes but i cant find the correct one.
    please give an examle about net share command.
    thanks a lot.

  • How to control tcp connection with java tcp socket programing ??

    Hi,
    I am connecting a server as using java socket programming.
    When server close the connection (socket object) as using close() method ,
    I can not detect this and My program continue sending data as if there is a connection with server.
    How to catch the closing connection ( socket ) with java socket programming.
    My Client program is as following :
    import java.io.PrintWriter;
    import java.net.Socket;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        try
                          socket = new Socket("localhost",5555);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            pw.println(i+". message is being send.");
                            Thread.sleep(5000);
        } catch (Exception ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

    I changed the code as following. But I couldn't catch the EOFException when I read from the socket. How can I catch this exception ?
    import java.io.BufferedReader;
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        BufferedReader bufIn=null;
        InputStreamReader inRead=null;
        InputStream in=null;
        try
                          socket = new Socket("localhost",5555);
                          in = socket.getInputStream();
                          inRead = new InputStreamReader(in);
                          bufIn = new BufferedReader(inRead);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            try
                              bufIn.readLine();
                              pw.println(i+". message is being send.");
                              System.out.println(i+". message has been send");
                            } catch (Exception ex2)
                              System.out.println(ex2.toString());
                              System.out.println(i+". message could not be send");
                            } finally
                            Thread.sleep(5000);
        } catch (EOFException ex)
                          ex.printStackTrace();
        } catch (InterruptedException ex)
                          ex.printStackTrace();
        } catch (IOException ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

  • How to use a proxy with java applications?

    I have a nokia 6300 type s40v3
    hello,
    I would like to know if it is possible to use a proxy of any and how ? kind with java applications.
    thank you

    Well, it works well when, into my applet, i do somethig like this:
    URL url = new URL(host);
    URLConnection connexion = url.openConnection();My applet uses proxy setting from IE6 but only if i use Java 1.4.2_08.
    With IE6 and Java 1.5.04, it doesn't work (my applet doesn't use proxy settings)
    With Firefox and Java 1.5.04, it's ok
    Have you already seen a problem like this with Java 1.5.04 ?

  • How long we can go with Java from now on?

    Days ago, the forum is blue. But now change to red.
    Java, will it still be hot like along with Sun? How long we can go with you?

    JoachimSauer wrote:
    mrjava wrote:
    What will be the strategy of Oracle with MySQL now?They claim to support it in full and continue development.
    But this is really off-topic here ... we're not the oracle about everything related to Oracle.Not breathing the smoke of the correct kind of leaves, eh?
    :D
    ¦ {Þ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get php content with java ??

    i have made a php file what will display a number,
    here's a example
    <?php
    if ($action == "answer"){
    echo "18274926";
    ?>
    no i want to get the number with java
    so here's my java code
    import java.io.*;
    import java.net.*;
    import java.util.Date;
    class URLConnecties
        public static void main(String args[]) throws Exception
            int teken;
            URL url = new URL("http://www.gamer.mineurwar.nl/net/javachallenge.php?command=DaTe");
            URLConnection urlconnection = url.openConnection();
            System.out.println("Type inhoud: " +
                urlconnection.getContentType());
            System.out.println("Datum document: " +
                new Date(urlconnection.getDate()));
            System.out.println("Laatst gewijzigd: " +
                new Date(urlconnection.getLastModified()));
            System.out.println("Document vervalt: " +
                urlconnection.getExpiration());
            int lengteinhoud = urlconnection.getContentLength();
            System.out.println("Lengte inhoud: " + lengteinhoud);
            if (lengteinhoud > 0) {
                InputStream in = urlconnection.getInputStream();
                while ((teken = in.read()) != -1) {
                    System.out.print((char) teken);
                in.close();
    }if you change the url ro a .html file it displays the code correctly(source),
    but when trying to get the content of a php file (the number)
    it says that there is no content from the php file
    yhe source of the original php file what's in the code can be found at
    www.gamer.mineurwar.nl/net/javachallenge.txt

    The 'content' is generated dynamically by a PHP script so the "content lenght" can't be known in advance by the server. For this reason connection.getContentLenght() returns -1; it doesn't mean that there is no content, only that it can't be known how much there will be.
    To solve the issue, remove the if statement from around the while-loop:// if (lengteinhoud > 0) { DELETE THIS LINE
    InputStream in = urlconnection.getInputStream();
    while ((teken = in.read()) != -1) {
        System.out.print((char) teken);
    // } and this too

  • How to launch a navigator with java

    I would like to know how we can launch navigators such as Netscape, internet Explorer or Opera with java
    thanks

    Nobody will answer you because of your appaling behaviour on the forum so far. I have to browse this forum in work, with colleugues around. This may sound silly, but it looks bad when I browse a forum with "I fuck Microsoft" posted on it, know what I mean?

  • How to connect via telnet with Java?

    I want to develop an application in a server with solaris 8. I want to access from this server to another server in a LAN via telnet and write down the information i am getting in a file. How i can do this in java? it's a good alternative? or i should try C++. Thanks in advance.!

    You can easily use java....just get a hold of the RFC for Telnet or if you look around, you can find code on the net already working.

  • How to let JavaScript   Communication with java

    he *,
    i have develop a firefox extension , i am using liveconnect let javascript communicate with java,
    it's my java code :
    public class javaCode{
            private int i;
            public javaCode() {
                    this.i = 0;
            public void testCount() {
                    while (true) {
                            String msg = "Call Java Method Count :" + this.i;
    }my javascript :
    function test() {
                             var myClass = loader.loadClass('com.example. javaCodeclass); 
    var myObj = myClass.newInstance(); 
    var binval = myObj. testCount ();
                    }when i install the extension into my firefox , i get a problem that is when restart firefox after i instll it ,I can't open the firefox ,but i find the firefox process is still running
    the problem is looks like the java is using "while(true)" , so it's won't stop ,
    but how to solve the problem using js or java ??
    any idea ?
    cheers,

    bobby92 wrote:
    Actually , i don't know how it will be active , so i have to using while (true)No, I'm pretty sure you don't need to. There are few cases where while(true) is needed and this isn't one of them.
    but can't i using javascript to stop the java method ??Nope, not in the middle of a while loop.
    or how to solve the problem ?What was your problem in the first place, what are you trying to achieve?

  • How to run sscript shell with java program

    Hi everybody,
    i want to know how can i do to execute a script shelle (bash) with program java (if it s possible)
    for example this script:
    #!/bin/bash
    echo "hello"
    can i run it with java program or i have to make dome modifications .
    thank you for your help in advance.

    Well, if you want to be portable across platforms, you should write as much code in Java as possible and not rely on native scripts (I'm sure your script is more complex than this 'echo' example ;-) ).
    Having said that, you can use the java.lang.Runtime class and in particular its various exec() methods.
    Try something like this:
    Process p;
    try {
        p = Runtime.getRuntime().exec("myscript.sh");
    } catch (IOException ioe) {
    }You can then "interact" with the spawned process with the Process object returned by the exec method.
    Note you need to have the appropriate security rights.
    For more details, look at the API documentation here:
    http://java.sun.com/j2se/1.4.2/docs/api/
    hth,
    -Alexis

  • How i get hardware info with Java Applet

    Hello Everybody.
    first I am sorry for my english. This my first topic. I am a php developer and learning Java. I am developing a Java Applet.
    Can i get client hardware info with Java Applet
    Ýf i can How i do get hardware info with Java Applet.
    I need sample code or documentation.
    Thanx.

    TrojanMyth wrote:
    Hello;
    Can i get hardware info with Java ?? Have not a know people ?Applets are restricted, unless, as already noted, they are signed and accepted by the user. See
    http://java.sun.com/docs/books/tutorial/deployment/applet/security.html
    http://java.sun.com/docs/books/tutorial/deployment/applet/properties.html
    In general, since Java is designed to run on multiple operating systems and machine architectures it does not provide much access to the underlying hardware. As mentioned, you can access the os via methods in the java.lang.ProcessBuilder and Runtime classes.

  • How to use parameter file with java

    Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini

    If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
    parameter1=value1
    parameter2=value2
    parameter3=value3
    ...etc.
    and the values are retrieved using the java.util.Properties class - see:
    http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
    Sample use://Call chis method once, to load the props file.
    //props file is called "demo.properties", and is
    //in a directory that is included in the classpath
        private void loadMyProperties() throws Exception
         InputStream stream = getResourceAsStream("/demo.properties");
         if(stream == null)
             throw new Exception("stream is null!");
         demoProperties = new Properties();
         demoProperties.load(stream);
         stream.close();
    // Then you can retrieve properties in your code using:
    String param3 = demoProperties.getProperty("parameter3");
    //...etc

Maybe you are looking for

  • Invoices released automatically....

    In A/P we noticed that SAP released automatically invoices that are blocked for payment due to price discrepancies, though these discrepancies haven't been resolved. Few documents (among many others) were released for payment though they should have

  • Is meta data used for SEO if so how dose it work ?

    Is meta data used for SEO? I would like to know how to create meta data for SEO use. I found this on a form with the label mete data for SEO. Can anyone help me understand what the parts of this code are used for? <title>epecho | The visual works of

  • JDeveloper 9.0.3.1

    Does Jdeveloper manage the Connection pooling by itself? When I run my .jsp I get the following error: Error Message: JBO-30003: The application pool (CA_package1ModuleLocal) failed to checkout an application module due to the following exception: Er

  • HELP : Using XSQL programmatically

    Hi, I'd like to use XSQLRequest into a program, but the problem is what i want the XSQLRequest to process isn't a file but a buffer in memory such as a String. As XSQLRequest doesn't have a constructor with a String which contents a XSQL buffer and I

  • Why voice control/ Siri is not supported in the middile east?

    I am trying to use voice control / Siri to get near restaurants, shops. It keep gives me message says  can't find restaurants or any place i asked for in Kuwait. I hope I can find solution for this. It's disappointed If voice control not supported in