How can I set system date from java code?

Hi. I need to set the system date from my application. It must works on Windows7 so the "cmd /C date" must be executed with Administrator privileges.
I tried do it that
Process p = rt.exec("runas /user:" + env.get("COMPUTERNAME") + "\\Administrator \"cmd /C date " + dateYYYYMMDD + "\"");
Then process ask me for password for administrator but it terminates befor i send it. exitCode() returns 1.
Have you some idea how can I do it?
Regards for you.

At the very least, you need to read this and follow the advice it gives. That may or may not solve your problem, but it's a bare minimum.
http://www.javaworld.com/jw-12-2000/jw-1229-traps.html

Similar Messages

  • How to kill a system process from java code.

    Hi,
    i need to kill or remove windows system process like cmd.exe from java code.
    like removing it from end process in task mgr.
    i tried below code but its not removed.
    is there a better way we can do this.
    killing a system process from java code will create any issues?
       public static void main(String[] args) throws Exception {
       String[] cmd = { "cmd.exe" };
       Process p = Runtime.getRuntime().exec(cmd);
       p.destroy();
    any suggestions or ideas are really appreciated.
    thanks.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

  • How can i get system variable using java

    Hi,
    I just want to know how can i get system variables using java code.
    for example i want to get the the date for today or i want to get the number of processes that's running.
    Thanks alot

    Hi,
    I just want to know how can i get system variables
    using java code.
    for example i want to get the the date for today or i
    want to get the number of processes that's running.
    Thanks alotSome generic "system variables" are available though Java, usually through the System class.
    Date today = new Date();
    is instantiated with the current date and time.
    Other system values, like environment values, should be passed to java through the command line (-D option) by setting system properties.
    Finally, platform specific values like the number of processes running will have to be written in platform specific code and executed by JNI (java native interface).
    Java is platform or system agnostic. Common system values, like time, are implemented. Hopefully you won't need platform specific values.

  • How can I set document date automatically as system date?

    I use FBV1, FBV2, F-02, FB02. Posting date is automatically set as system date. I want to set document date automatically as system date.
    How can I set document date automaticall as system date?
    Wbr.
    İlker Çokkeçeci
    Computer Engineer
    Ankara, Turkey

    Hi Expert,
    Please refer the below link..
    Document date to be defaulted as system date for all FI transactions
    as there mentioned, please go to T-Code: SHD0.
    Regards,
    GK
    SAP

  • How we can update the  System Date,in java

    Hi guys,
    can U pls help me...
    How we can update the System Date,in java
    I need to get the System Date and time continuosly thruogh threads concept.kindly help me
    Thanking u in Advance

    System.currentTimeMillis() will give you the current
    system date and time as a long value.
    ~I think the OP wants to change the system time not just get the system time.

  • How can I restore my data from IBooks from IPad 2 to Ipad air. When I was set up, I forget to select restore backup. Now I have backup from iPad 2. I don't have any Mac PC.

    How can I restore my data from IBooks  and other program from IPad 2 to Ipad air. When I was set up, I forget to select restore backup. Now I have backup from iPad 2. I don't have any Mac PC..

    Restore from iCloud Backup (if you have backed up to iCloud)
    1. Settings>General>Reset>Erase all content and settings
    2. Tap Erase
    3. You'll see Apple logo and progress bar
    4. Hello
    5. Slide to set up
    6. Set language
    7. Set country
    8. Choose Wi-Fi network; enter Wi-Fi password
    9. (a) Use Location Service (b) Don't Use Location Service
    10. Select option
    11. (a) Setup as New iPad (b) Restore from iCloud Backup (c) Restore from iTune Backup
    12. Selected Restore from iCloud Backup
    13. Enter password for iCloud
    14. Agree to Terms and Conditions
    15. Setup Apple ID
    16. Select backup
    17. Restoring from iCloud
    18. Hello
    19. Restore Completed. Your iPad was restored successfully. There are just a few more steps to follow and then you're done!
    20. Continue
    21. Finish setting iCloud enter Password
    22. Updating iCloud settings
    23. Create a Passcode
    24. Welcome to iPad
    25. Get Started
    26. Restoring Apps and Media
    27. Enter Apple ID and Password
    28. Notice: Restore Incomplete, some items could not be downloaded from the Store. If they are on your computer, you can restore them by syncing with iTune
    29. Connect iPad to iTune to sync with computer
    30. Sync Music, Videos and Album Artwork

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • How can i get the data from database & add them as a link

    Hi,
    how can i get a data from a database(DB2) and that data will be having a file so i should make them as a link.i tried it in jsp .
    <%
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");     
    response.setContentType("text/html");
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:db2:spintran");
    Statement stmt = conn.createStatement();
    stmt.executeQuery("set current schema tut");
    ResultSet rs = stmt.executeQuery("select * from tutorial");     
    %>
    Type Of the Category : &nbsp&nbsp&nbsp
    <%
         while (rs.next())
         String desc = rs.getString(1);     
         out.println(desc);
    %>
         <A HREF = "<%=desc%>"><%=desc%> </A>
         <%
         %>
    but it is not working.how can i link.
    thank you.

    what is desc? is it the file name ? whats the data type of desc in db? INFILE?
    if desc is just the name of the file, then make sure that such a file exists in the proper folder.only then the link works..
    that is, if desc is 'a.jpg' then a.jpg should be existing in the same folder as your html is.

  • How can I extract the data from Xstring .

    Hi Gurus ,
    How can I extract the data from a XSTRING  .
    I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
    Someone told me that there is a standard FM for that . but I am not able to find .
    Please reply with the FM in case some one knows about it .
    Thanks in advance .

    The following code works as of 7.0 (in any SAP system):
    FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
    TYPES : BEGIN OF ty_struc,
              line TYPE c LENGTH 100,
            END OF ty_struc.
    DATA lt_char TYPE TABLE OF ty_struc.
    DATA length TYPE i.
    length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = input
      tables
        binary_tab            = lt_char.
    CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
    output = output(length).
    ENDFORM.
    Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM

  • How can I set the data binding between Web Dynpro & Database table

    Dear friend,
    I am a beginner of Web Dynpro. I want to develop my simple project like these:
    1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
    2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
    For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
    1. How can I set the data binding between Web Dynpro and Database table ?
    2.  Are there any nescessary steps that I will concern for this case?
    Sorry if my question is simple, I had try  to find solution myself, but it not found
    Thanks in advances,
    SeMs

    Hi,
    You can write your own connection class for establishing the connection with DB.
    Ex:
    public class  ConnectionClass {
    static Connection con = null;
    public static Connection getConnection() {
    try{
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
    con = ds.getConnection();
    return con;
    }catch(Exception e){
    return null;
    You can place the above class file in src folder and you can use this class in webdynpro.
    You can have another UserInfo class for reading and writing the data into the DB .
    Regards, Anilkumar
    PS : Refer
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
    Message was edited by: Anilkumar Vippagunta

  • How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    Restore from the iCloud backup - assuming that you were backing up to iCloud in the first place. If you weren't using iCloud for backup - then you are out of luck.
    If you were backing up to iCloud - you have to erase all contents on the iPad in Settings>General>Reset>Erase all content and settings - before you can restore from the iCloud backup.
    Read this article before you do anything else
    http://gigaom.com/apple/ios-101-set-up-and-restore-from-icloud-backup/

  • How can we set page title from resource bundle

    Hi friends ,
    how can we set page title from resource bundle,
    <%--
        Document   : MARC008Music
        Created on : Aug 4, 2008, 6:27:06 PM
        Author     : root
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
    <title>All Transaction Log Details </title>
          </head>
        <body>
            <f:view>
                <f:loadBundle basename="#{utility.resourceBundle}" var="rb"/>
                <f:loadBundle basename="#{utility.messageBundle}" var="mb"/>
                <h:form>
                </h:form>
            </f:view>
        </body>
    </html>i want set title( All Transaction Log Details ) from resource bundle.

    My problem is solved , Thanking you Sir.
    Thanks & Regards,
    Edukondalu Avula

  • How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    So what is your question?
    If you forgot your encryption password:
    Warning: Make sure it's a password you will remember or write it down for safekeeping. If you encrypt an iPhone backup in iTunes and forget your password, you can't restore from backup and your data will be unrecoverable.
    If you can't remember the password and want to start again, you must perform a full software restore and chooseset up as a new device when iTunes prompts you to select the backup from which to restore.
    The above comes from here:
    http://support.apple.com/kb/HT4946

  • How Can we get the data from Non-SAP to SAP in WebDynpro

    Hi,
    I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
    Help out with the steps for getting the data or procedure.
    Regards,
    Mutyapu

    You can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
    Regards,
    Nithya

  • How can I set a music from my music library as a Ringtone on my Iphone?

    How can I set a music from my music library as a Ringtone on my Iphone?

    http://www.ehow.com/how_4810307_free-iphone-ringtones.html

Maybe you are looking for

  • /var/adm/messages

    Hi, I am trying to get some info from google about the following messages in the /var/am/messages, but I don't get anything. ipfs: [ID 103742 kern.notice] /u06: memory limit of 10485760 exceeded ipfs: [ID 459658 kern.notice] /u06: active up normal -

  • Any Idea when Apple will email the redemption code for Mountain Lion?

    Any Idea when Apple will email the redemption code for Mountain Lion? I got a code but it said it was invalid on the app store. When will this issue be solved? Kind of getting impatient, given I dropped 2k over their product...

  • Where to buy oracle openworld presentations?

    Hi all, I've been searching for the whole oracle website and could not find the url for buying all the presentations for oracle openworld. (or just database presentations) can anybody help? thanks andrew

  • NSURLErrorDomain error -1012. What does this mean?

    I'm trying to make a call to an OData resource using the OData iOS SDK and every call gives me this error code: The operation couldn't be completed. (NSURLErrorDomain error -1012.) What does NSURLErrorDomain error -1012 mean? Thanks!

  • Are sharpening and noise reduction working in 1.0?

    I went to see if they'd made any improvements in the noise reduction area, and can't get any of the noise reduction or sharpening settings to effect the image at all. The settings definitely aren't making any changes to the visible image in normal or