🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14971

Re: Reset a Windows system clock ?

#14971
From: Rich Wilkman
Date: Wed, 21 Jul 1999 00:00
58 lines
2830 bytes
John:

I bet they'll have a command.com equivalent and a bunch of dlls to pick
up the rest of the slack (at least for batch files).

-Rich

"John R. Collins" wrote:
> 
> Jason Singer <jintsjason@worldnet.att.net> wrote in message
> news:7lihbc$3965@forums.borland.com...
> > I nedd to be able to reset a Windows system clock direct from Java code. I
> > am presently able to do it using a Runtime exec command:
> >
> >         Process p1 = rt.exec("tmp123.bat");
> >
> > where the bat file has a time command in it.
> >
> > I would like to be able to do from direct java statements. Can anyone
> help?
> 
> The only way you are going to be able to do that is by writing a class with
> a native method declared in it, running javah -jni, playing with the
> resulting .h file to create a compatible .c or .cpp file that calls the
> Windows service for that, compiling and building a .DLL from it, and then
> doing a System.loadLibrary("MYSETTIME.DLL") in your class's static
> constructor.  If you do this, make sure you put a try {} catch (Exception
> ex) { ex.printStackTrace(); } around your loadLibrary call because otherwise
> if it fails, which is quite likely at first or if the DLL's directory is
> lost from the PATH variable, you will receive no diagnostics.  Which trust
> me, is not fun.
> 
> Along the way you will have to learn JNI, debug and test your DLL, and all
> sorts of other mundane things.
> 
> I would recommend staying with the .BAT file.  It has a certain economy of
> labor and elegance.
> 
> When NT 5 comes out, then you may be forced to revisit the .DLL route
> because that version is supposed to excise DOS completely, whatever that
> means.  Not coming out till around 2001 anyway though.
> 
> John

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Quality Assurance Manager
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <3795EE4E.2D736D7@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7lihbc$3965@forums.borland.com> <7n4cf3$k001@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,9b630580e4ee913
X-Google-Attributes: gidf74b3,public
From: Rich Wilkman <rwilkman@inprise.com>
Subject: Re: Reset a Windows system clock ?
Date: 1999/07/21
Message-ID: <3795EE4E.2D736D7@inprise.com>
X-Deja-AN: 503577067
Content-Transfer-Encoding: 7bit
References: <7lihbc$3965@forums.borland.com> <7n4cf3$k001@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language