How to set the system time in the program

Hi All,
How do we update the system time inside java programme.

AFAIK there is no easy (pure java) way: either you exec something (depending on your paltform) or use native code. Appropriate privileges will be necessary.

Similar Messages

  • How can i get the System Time from the other host

    I want to get the System Time from the other host in the LAN,How can I get the Time using Java.
    Such as I am in WIN 2000 and I have a Unix host in LAN, I want to get unix host System time, How can I do it.

    Open a socket to port 13 and read a string with the time.
    -or-
    Open a socket to port 27 and read 4 bytes that are a network order timestamp
    Assuming that your UNIX machine has those services running, most do

  • How do you return System Time of the local box in FTP command

    How do you return System Time of the local box in FTP command... since I want to output the system time of my local box copying to the FTP server...

    Its asking me to enter a new date... I actually want to return it into a log file since I am using ws_ftp.... but the log files dont have any date time being returned... i just want to be able to echo that date time into the log file... but it doesnt do that... I also tried
    SHELL ECHO %DATE% %TIME%
    but it returns this in the log file
    Processing Line 10 [SHELL ECHO %DATE% %TIME]
    I also tried in my ws_ftp script and it says:
    Processing Line 15 [!Date]
    Sending command [!Date] with parameter []
    !Date
    500 '!DATE': command not understood
    Failure in command [!Date]

  • Changing the System time in the JVM where Weblogic runs

    Hi,
    I am trying to change the System time where the Web-logic server (11g) runs using Mocking. I use "jmockit.jar" to mock the System.class. A Spring bean is created and through that I try to change the System time. I need to change the time for testing scenarios. For example, I need to backdate and do the testing for some scenarios. For the moment I do this manually and I want to automate this by changing only the time in the JVM where the application server runs. When I try to automate this using the Spring bean, I get an error as follows. Do anyone have any idea about this.
    [WLServer adminserver] Exception in thread "Timer-5" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at java.util.TimerThread.mainLoop(Timer.java:495)
    [WLServer adminserver] at java.util.TimerThread.run(Timer.java:462)
    [WLServer adminserver] Exception in thread "DynamicListenThread[Default]" java.lang.IllegalArgumentException: No class with name "com.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at java.util.logging.LogRecord.<init>(LogRecord.java:139)
    [WLServer adminserver] at com.bea.logging.BaseLogRecord.<init>(BaseLogRecord.java:33)
    [WLServer adminserver] at com.bea.logging.BaseLogRecord.<init>(BaseLogRecord.java:48)
    [WLServer adminserver] at com.bea.logging.BaseLogRecord.<init>(BaseLogRecord.java:70)
    [WLServer adminserver] at weblogic.logging.WLLogRecord.<init>(WLLogRecord.java:63)
    [WLServer adminserver] at weblogic.logging.JDKLoggerFactory.createBaseLogRecord(JDKLoggerFactory.java:74)
    [WLServer adminserver] at com.bea.logging.LoggingService.log(LoggingService.java:216)
    [WLServer adminserver] at weblogic.server.ServerLogger.logListenThreadFailure(ServerLogger.java:205)
    [WLServer adminserver] at weblogic.server.channels.DynamicListenThread.run(DynamicListenThread.java:197)
    [WLServer adminserver] at java.lang.Thread.run(Thread.java:619)
    [WLServer adminserver] Exception in thread "weblogic.timers.TimerThread" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at weblogic.timers.internal.TimerThread$Thread.run(TimerThread.java:256)
    [WLServer adminserver] Exception in thread "Timer-4" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at java.util.TimerThread.mainLoop(Timer.java:495)
    [WLServer adminserver] at java.util.TimerThread.run(Timer.java:462)
    [WLServer adminserver] Exception in thread "ClusterNode-localhost" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at EDU.oswego.cs.dl.util.concurrent.Latch.attempt(Unknown Source)
    [WLServer adminserver] at org.apache.jackrabbit.core.cluster.ClusterNode.run(ClusterNode.java:261)
    [WLServer adminserver] at java.lang.Thread.run(Thread.java:619)
    [WLServer adminserver] Exception in thread "Timer-1" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at java.util.TimerThread.mainLoop(Timer.java:495)
    [WLServer adminserver] at java.util.TimerThread.run(Timer.java:462)
    [WLServer adminserver] Exception in thread "ClusterNode-localhost" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at EDU.oswego.cs.dl.util.concurrent.Latch.attempt(Unknown Source)
    [WLServer adminserver] at org.apache.jackrabbit.core.cluster.ClusterNode.run(ClusterNode.java:261)
    [WLServer adminserver] at java.lang.Thread.run(Thread.java:619)
    [WLServer adminserver] Exception in thread "Timer-2" java.lang.IllegalArgumentException: No class with name "com.abc.common.service.impl.MockSystem" found
    [WLServer adminserver] at mockit.internal.util.Utilities.loadClass(Utilities.java:71)
    [WLServer adminserver] at mockit.internal.MockingBridge.callMock(MockingBridge.java:156)
    [WLServer adminserver] at mockit.internal.MockingBridge.invoke(MockingBridge.java:85)
    [WLServer adminserver] at java.lang.System.currentTimeMillis(System.java)
    [WLServer adminserver] at java.util.TimerThread.mainLoop(Timer.java:495)
    [WLServer adminserver] at java.util.TimerThread.run(Timer.java:462)
    [WLServer adminserver] Exception in thread "weblogic.time.TimeEventGenerator" java.util.MissingResourceException: Can't locate bundle for class 'weblogic.common.T3MiscLogLocalizer'
    [WLServer adminserver] at weblogic.i18ntools.L10nLookup.getLocalizer(L10nLookup.java:427)
    [WLServer adminserver] at weblogic.i18n.logging.CatalogMessage.<init>(CatalogMessage.java:47)
    [WLServer adminserver] at weblogic.common.T3MiscLogger.logThrowable(T3MiscLogger.java:325)
    [WLServer adminserver] at weblogic.time.common.internal.TimeEventGenerator.run(TimeEventGenerator.java:126)
    [WLServer adminserver] at java.lang.Thread.run(Thread.java:619)
    OR
    Do anyone know any other way to overcome this issue using some other mocking jar.
    Thanks
    Edited by: 913136 on Feb 8, 2012 2:32 AM

    Hi,
    I could manage to change the time in JVM where the Weblogic server runs. I loaded an Spring bean from my Test class and from that bean I set an offset (to shift the time) in the Mock class (say, MockSystem class). In this case I used the jmockit implementation for instrumentation purposes. The MockSystem class should not be instantiated by us and jmockit takes care of that part. What I had to do was defining the javaagent and another parameter ("-Djmockit-mocks=com.abc.common.service.impl.MockSystem") in the Weblogic server build XML (mentioned in the following URL[1]). But to work this the MockSystem.class file should be wrapped in a JAR file and included in Weblogic server/lib directory and define it in the Weblogic build XML file as a classpath. For more explanations visit this URL [2].
    [1]. http://jmockit.googlecode.com/svn/trunk/www/javadoc/mockit/Mockit.html#setUpStartupMocks%28java.lang.Object...%29
    [2]. http://code.google.com/p/jmockit/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Tool%20Type%20Status%20Priority%20Summary&groupby=&sort=&id=207
    Thanks
    -thiwanka-

  • How to set a system property via the config tool?

    Hello,
    how can I set a system property via the config tool? Before I chose WAS from SAP I used java with option -D<name>=<value> to set the system properties.
    Very much thanks in advance.
    Regards
    Carsten

    Hi Carsten,
    WAS config tool is located under
    e.g. usr\sap\J2E\JC00\j2ee\configtool
    start configtool.bat
    there will be opened a configuration tool GUI
    Click on the instance_ID.... leaf of the tree in the left pane and then on the server_ID.... leaf.
    Java settings will appear in the right pane after this steps.
    Best Regards,
    Violeta

  • How to pass Current System time in the target field?

    Hi Experts
    kindly help me in mapping a field in which I have to map current system time.
    I think there is no standard function for time like the date so do i write a UDF for the same or any other way an in case a UDF than please help in that.
    Thanks
    Aprajita

    Hi Mathur,
    kindly help me in mapping a field in which I have to map current system time.
    I think there is no standard function for time like the date so do i write a UDF for the same or any other way an in case a UDF than please help in that.
    Mathur no need to write UDF for that..
    Use standard function Current date-------> In that (Target Format) u have to specify the time i.e: HHmmss
    Thats it..... Noe use this function as u like...
    Satya Kumar

  • Changing the System Time

    I am using a SunBlade 1000 and C++ with Workshop 6.1. I would like to change the system time via a program written in C++ without having to log in as super-user. Is that possible ? I was thinking about using the settimeofday function, but according to the man information I only can use it as super-user.

    You are correct. Only root can set the system time. You should
    probably consult your local system admin or discuss the implications
    of trying to do this in the Solaris forum. There are possible security
    holes opened up by trying to do root's job programatically.
    In general, a C program can use the system() call to run a command
    that would be typed in at the shell. A program can also have the
    Set UID bit and run as root, but you should be well aware of the
    risks associated with that before you try to use it.

  • I want to get and set windows system time through lab view

    Hi
    I want to get and set windows system time with the help of lab view 8.5.
    please help me out.
    ekanth

    You can use the call library function node. Once you drop it on your block diagram double click it and you will be able to select the dllyou want to use. Choose kernel32.dll and you will see methods listed called getsystemtime and setsystemtime. Use those
    CLA, LabVIEW Versions 2010-2013

  • How do I set the system time?

    Hello
    The system time can be read using System.currentTimeMillis(), but, how can I set it?
    Thanks

    several approaches:
    you could use the OS function to set and call it via Runtime.exec().
    For WIndows e.g.: "time 08:15:00" to set the system time.
    another solution: http://www.rgagnon.com/javadetails/java-0285.html

  • How to display the Date Time using the System Time zone

    Friends,
    Can anyone help me with below scenario..
    I have to display Date Time on a jsff page, This value associated to one of Transient View object populated from the database.. Is there any way I can handle on the screen to display the same date /time bassed on the system time zone ?
    I know one way how we can handle it.. while populating to View object we can set the time based on the system time zone.. but it would be easy and simple if there is any approach I can use on UI layer itself..
    thanks

    I don't understand why this display doesn't pay attention to the date/time format settings that are set in the language and text prefs.
    Those settings are used for date OR time, and provide for different displays depending on the space available. The menu bar does not have a fixed space available, and wants both date and time.
    In Leopard, it used the medium time format. To get the date and time, you could modify that format to include the date, but that could cause problems with software that happened to use the medium time format and expectede just the time. Also, you might want to change the medium time format without changing the menu bar display. For these reasons, Snow Leopard's menu bar clock uses its own formatting for data and time display.

  • How to get the system time in a Swing application ?

    I know how to do it in JavaScript, but not java. Please help me, and also how to get the system time in an Applet. Thanks !!!

    Check this link, I hope it helps
    http://202.71.136.142:8080/globalleafs/Swing/View.jsp?slno=22&tbl=0

  • How to set the interval time in the   JFormattedTextField? Pls Contribute..

    Hi Frienz,
    Hi have a following code in which i want set the interval time for the TextField by 15 min
    So how it is possible please tell me out.
    DateFormatter frmtr = new DateFormatter();
                   SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
                   frmtr.setFormat(sdf);
                   frmtr.setAllowsInvalid(false);
                   DefaultFormatterFactory factory = new DefaultFormatterFactory(frmtr, frmtr, frmtr);
                   fmtToTime.setFormatterFactory(factory);

    AFAIK there is no easy (pure java) way: either you exec something (depending on your paltform) or use native code. Appropriate privileges will be necessary.

  • How to change the system time in (E-Business Suite)

    Hi,
    I need to change the system timings in E-Business Suite.
    My Database & Application is on different nodes..
    How could i change system timings on both...
    Thanks,
    Alig

    Alig,
    Changing the OS date/time will have no impact on the data (except for the scheduled jobs at the database and the OS levels). As mentioned in the threads I referenced above, you have to stop the application/database, change the date/time at the OS level, and start the application.
    The application is just an interface which connects to the database, so it gets all the data from the database server. However, if you want to change the date/time it has to be done on both nodes (stop all the services first as mentioned above).
    Btw, what is the point of changing the date/time because of Ramadan? The business requirement of your client does not make sense (how does it differ from the application/database perspective if you start working at 9:00 AM instead of 7:00 AM for example)?
    The steps in the document should be enough, and if you do not trust any of the replies here you could simply log a SR and confirm this with Oracle support.
    Thanks,
    Hussein

  • How to set the exposure time and the gain of a connected camera with IMAQ USB

    A camera was connected to my computer with USB port and we can acquire the image through IMAQ USB.  Now we have to set separately the exposure time and the gain with the camera's driver software provided by the manufacturer.  My question is: how to set directly the exposure time and the gain of this camera in Labview?

    Hi Frank
    Welcome to the forum. Have fun
    FranklinT wrote:
    My question is: how to set directly the exposure time and the gain of this camera in Labview?
    I think its not possible for USB Cameras. 
    Previous threads for your ref
    http://forums.ni.com/t5/Machine-Vision/How-to-control-property-nodes-for-USB-camera/td-p/970306
    http://forums.ni.com/t5/Machine-Vision/imaq-USB-property-page/td-p/926034
    Sasi.
    Certified LabVIEW Associate Developer
    If you can DREAM it, You can DO it - Walt Disney

  • HT201303 last time i bought apps by using visa gift card so iam trying to use the kind of visa gift card and the system is denying the method payment ....any idea how to solve this with my itune account ?

    last time i bought apps by using visa gift card so iam trying to use the kind of visa gift card and the system is denying the method payment ....any idea how to solve this with my itune account ?

    A few reasons I can think of, but instead of shooting in the dark, lets check with experts who can look at your account.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

Maybe you are looking for

  • Posting of Bank Charges not Possible

    Hi Sap Gurus, I have a question/problem regarding the bank statement upload process (TC: FF_5) Maybe someone has a solution for this, orhas  the same problem. First we've run the payment run to clear/pay our vendors a) Invoice Posting (40 Expense (De

  • Problem: launch javaBean method in Javascript?

    I want to launch a method of javaBean in javascript, but it always occur errors. the main code is as following: <jsp:useBean id="getPropertyBean" class="mmes.BeanSetExamProperty" scope="page"/> <html><head> <script language="JavaScript" type="text/Ja

  • Inserting avi in to Framemaker

    Hello When I embed an avi file in to Framemaker, it never shows up in the created pdf. I'm just doing it via File > Import > Object... selecting Create from File, picking the file and then OK.+ Anyone any ideas?

  • IPhoto 08 and iPhone 4 HDR

    I am using iPhoto 08 (7.1.5) and I just imported some photos from my iPhone 4 using HDR. When I look at the photos, all of the photos have ghost lines around them. Is HDR not compatible with iPhoto 08. Upgrading to 09 is not an option as I don't have

  • Repository conversion (from 6.0 to 6i)

    Does somebody know if it is possible to install the designer 6.0 under Oracle 8.1.7 and after importing a .dmp file (containing a designer application v. 6.0) intalling a designer 6i (under Oracle 8.1.7) in order to convert my v. 6.0 application to a