Reset System Date Through Java

How to change system date through java. I need some help for developing some software in java.

as in there is a command :-
#include <iostream.h>
#include <dos.h>
int main(void)
{ struct date reset;
setdate(&reset);
return 0;
how can i convert it into java language and reset System date of windows, help me.

Similar Messages

  • How to change system time through java program

    Hi
    I want to know, how to change system time through java program.
    give me a idia with example.
    Thanks

    There isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
    ~

  • 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 to calculate system date through function module date

    Hi friends!!
    i declare a variable "date like sy-datum".
    now i want to add 15 days to the system date,
    please give me the function module name which can do it.
    xample.
    date = sytem date. -> date= 13/08/2010
    i want                          date= 28/08/2010.
    please help.
    Edited by: sandeep08 on Aug 13, 2010 1:53 PM
    Moderator message: date calculation questions = FAQ, please search before posting.
    locked by: Thomas Zloch on Aug 13, 2010 2:03 PM

    Hi,
    You can directly add 15 to the date. It will give you appropriate results.
    Regards,
    Aparna Alashe.

  • How to get system date through forms 6i?

    Sir,
    I am trying to get system date in forms but i am getting some problem with it.
    My code is like this: I am using 6i forms with 10g database.
    SELECT SYSDATE INTO :VAR FROM DUAL;
    At the compilation it is giving error like
    ORA-00600 internal error argements
    can you help me please

    you can make this code instead of what you write in forms
    :VAR :=Sysdate;
    and make var variable of type date
    concern the error try to close the forms builder and open it again and recompile your form.
    hope this will help you

  • 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

  • Accessing CPU clocks or system timers through java

    Hello ,
    We want to get access to system CPU clock which should run even when the system is shutdown. Additionally first time it should be set by a java program and it should run for some specific days amount of time . It should remain unaffected if the external user changes the system time displayed. Can it be possible through any means in java ???

    Hi
    we are designing an application which should run only for 15 consecutive days,we dont want the user to hack it by any means by changing the system time,so we want to have access to the system time which works with the help of battery backup or some other means by which we can detect whether the user has altered the system time.

  • Getting  the current operating system information through java

    hi ,
    How can i get the information about the current operating system on which i am working through the java application.

    System.getProperties() and look through the results. All kinds of interesting stuff in there.

  • Reading Excel data through java servlets

    I am doing a project in jsp and servlet. During the project i have to read some excel data from the excel sheet and store them to DB2 database. While reading from the data from the excel sheet a problem occurred. I have used the poi package to read the data from the excel sheet and the code is correct and it reads the excel sheet. Now i just displayed the number of rows and cells in the excel sheet and while displaying the value of the every cell, the servlet displays only the address of each cell instead of displaying the value. Here i am attaching the code that i have used and the output of the servlet.
    One more thing that i have noticed here is i just wrote a simple java program to read the excel data using the same steps that used earlier in the servlet. In this case the program displays the actual value of the excel cell.
    Could you please help me to solve the problem.
    try
    String fileName = req.getParameter("file1");
    String filePath = "C:
    Program Files
    Apache Software Foundation
    Tomcat6.0
    webapps
    kbsearch
    WEB-INF
    Excel Fles
    "+fileName;
    poifs = new POIFSFileSystem(new FileInputStream(filePath));
    book = new HSSFWorkbook(poifs);
    sheet = book.getSheetAt(0);
    int totalRow = sheet.getLastRowNum();
    out.print("Total Number of Rows: "+totalRow);
    for(int i=2; i<=totalRow; i++)
    row = sheet.getRow(i);
    int totalColumn = row.getLastCellNum();
    out.print("<br>Total Cell: "+totalColumn);
    for(int j=0; j<=totalColumn; j++)
    cell = row.getCell((short)j);
    out.print("<br>Cell Value: "+cell);
    catch(Exception e)
    out.println("
    Error: "+e.getMessage());
    OUTPUT
    Total Number of Rows: 9
    Total Cell: 9
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1450f1f
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@e3f02a
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@ac622a
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@160c21a
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1677737
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1c3dc66
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1babddb
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1069693
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@187b360
    Cell Value: org.apache.poi.hssf.usermodel.HSSFCell@1172c5

    My copy of POI came with documentation including the Javadocs part:
    org.apache.poi.hssf.usermodel.HSSFCell
    double getNumericCellValue()
        get the value of the cell as a number. For strings we throw an exception. For blank cells we return a 0.
    public java.lang.String getStringCellValue()
    get the value of the cell as a string - for numeric cells we throw an exception.
    For blank cells we return an empty string.
    For formulaCells that are not string Formulas, we return empty String
    */

  • System calls through Java stored Proc

    Hi,
    Aim: Execute host command from pl/sql thru java stored proc.
    1. Created a java class to take system command that could be executed.
    2. It runs fine when the class file is executed.
    3. when the java file is loaded to database to access it as java stored proc, for any valid and invalid system commands it is giving out 'PL/SQL successfully completed.
    Results were not seen.
    4. Java source file.
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static int RunThis(String[] args) {
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    String s = null;
    try
    Process p = rt.exec(args);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null) {
    System.out.println(s);
    System.exit(0);
    catch (Exception e){
    e.printStackTrace();
    rc = -1;
    finally {
    return rc;
    public static void main(String[] args){
    Util.RunThis(args);
    public static String exec(String args){
              Util.RunThis(args);
              return "Srini it is successful";
    5. When ran from host prompt (unix),
    executed successfully,
    $ /opt/java1.3.1/bin/java Util /usr/bin/ls -l
    Here is the standard output of the command:
    total 30862
    -rwxrwxrwx 1 xyz develope 1348218 Jan 2 17:47 02Jan03-2.zip
    -rw-r----- 1 xyz develope 21864 Jul 9 2002 109-60_2_modified7.sql
    -rw-r----- 1 xyz develope 44934 Jul 9 2002 109-60_2_modified8.sql
    Here is the standard error of the command (if any):
    xyz@xxxxx:abcd:/home/xyz
    $
    6. loadjava,
    $ loadjava -user username/password Util.java
    7. Create proc,
    SQL> create procedure echo_input(s1 varchar2) as language java name 'Util.main(java.lang.String[])';
    2 /
    Procedure created.
    8. Execute proc.
    SQL> exec echo_input('/usr/bin/ls -l');
    PL/SQL procedure successfully completed.
    SQL> exec echo_input('/home/o_report/reports/rcli_ASCT &');
    PL/SQL procedure successfully completed.
    SQL> set serverout on
    SQL> exec echo_input('/home/o_report/reports/rcli_ASCT');
    PL/SQL procedure successfully completed.
    SQL> exec echo_input('ddsafafasf');
    PL/SQL procedure successfully completed.
    TIA,
    Srini.

    Hi Srini,
    This is just a suggestion, but try entering the following commands (in your SQL*Plus session) before executing your stored procedure:
    set serveroutput on size 1000000
    exec dbms_java.set_output(1000000)Hope this helps.
    Good Luck,
    Avi.

  • How to access system registry through java program

    Friends
    I have to access System registry of Windows 2000 by Java program. I don't know how to access the registry by using java code. Please help me. Else
    I want to create a setup file for my application. before setup my application i have to check whether the system has JVM or not. If its not then i have to install JVM first and then my application. so i need to access system registry. please give me a solution for this.
    Thanks in advance
    Ramesh

    I don't know how to access the registry
    by using java code. You can't, without using a native interface (JNI type) library.
    This is one, there are others, do a Google search:
    http://www.bayequities.com/tech/Products/jreg_key.shtml

  • Issuing Solaris system calls through Java

    How can I issue a system call to Solaris using Java? (i.e. Start a script, open a file, and similar)

    Hi Srini,
    This is just a suggestion, but try entering the following commands (in your SQL*Plus session) before executing your stored procedure:
    set serveroutput on size 1000000
    exec dbms_java.set_output(1000000)Hope this helps.
    Good Luck,
    Avi.

  • System information through java

    To find the following info. What and all required, and how to implement in java..please give idea..or some tool or open source
    1) Physical memory(installed)
    2) CPU Speed(current)
    3) Available disk space(primary partition)
    4) Operation system, version and service pack
    thank in advance..

    System.getProperty("os.name"); and so on. Read the documentation of package java.lang.System

  • Is there  any way to get a big system icon through  java?

    the getSystemIcon() method returns a little icon, perfect for a JTree implementing a file tree. I'd like to be able to get the big version of it.
    how to do?

    I think they mean javax.swing.filechooser.FileSystemView getSystemIcon but I don't believe anything more is possible built in to the API then that.

  • Help need on inserting system date on database

    hello every body,
    I need to insert system date into database through prepared statement.
    i wrote code :
    java.util.Date d=new java.util.Date();
    Preparestatement psmt;
    psmt.setDate(8, java.sql.Date(d));
    am getting class cast exception :
    could u please tell me how to insert system date through prepared statement..
    thanks in advance..

    Surround your code with a
    try{
    //Insert date here
    catch(Exception e){
    //handle exceptions here
    e.printStackTrace();
    Who says he didn't already?
    Try this:
    java.util.Date d=new java.util.Date();
    >
    Preparestatement psmt;
    psmt.setDate(8, new
    java.sql.Date(d.getTime()));This is correct, but can be condensed (if you want)
    psmt.setDate(8, new java.sql.Date(new java.util.Date().getTime()));
    >
    It's good idea to use the JDBC escape function
    instead of using a specific DBMS function. This way,
    your code will be portable.
    sql = "INSERT INTO USERS VALUES("
    + "'" + userName + "'" + ","
    + "'" + userPw   + "'" + ","
    + "  {fn now() }  )"; e Real's How To
    (http://64.18.163.122/rgagnon/javadetails/java-0567.ht
    ml)
    And this is only marginally applicable.  If he wishes to use the same statement for the current date, as well as other dates, he cannot make use of this.  Of course, I don't really know if I would trust or recommend a tutorial site that advocates building statements that are screaming for injection attack attempts.
    Edit:  Too slow by a mile!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for