Thread View: borland.public.jbuilder.java.language
3 messages
3 total messages
Started by Peter POCATKO
Thu, 12 Jan 2006 23:00
Start and stop program from command prompt
Author: Peter POCATKO
Date: Thu, 12 Jan 2006 23:00
Date: Thu, 12 Jan 2006 23:00
27 lines
1916 bytes
1916 bytes
Hello , I finishing program in java and my vision is that after start Windows 2003 is going to start my program . Is working fine . I run it from bat file in startup and it looks like : xxx.bat start "MyApplication" /min java -jar MyApplication.jar start Problem is and I working on it couple of days without any solution. That I know that if low battery event is generated on UPS after that is run bat file on Windows 2003 , where are commands for safe shutdown of virtual disks and operating system and I need firstly from the same bat file safe shutdown MyApplication where is running in thread INSERTs commands and after that is starting timer which can be set from 1 to 99 minutes and during this time I would like shutdown MyApplication ... and it run to round of course .. for example yyy.bat start "MyApplication" /min java -jar MyApplication.jar stop Have you any idea how it can do this ? I tried something but it didn`t work but I like to hear some other opinion. Thanks
Re: Start and stop program from command prompt
Author: Lori M Olson [TeamB]
Date: Fri, 13 Jan 2006 16:27
Date: Fri, 13 Jan 2006 16:27
54 lines
2783 bytes
2783 bytes
Peter POCATKO wrote:
> Hello ,
>
> I finishing program in java and my vision is that after start Windows 2003
> is going to start my program .
> Is working fine . I run it from bat file in startup and it looks like :
> xxx.bat
> start "MyApplication" /min java -jar MyApplication.jar start
>
> Problem is and I working on it couple of days without any solution. That I
> know that if low battery event
> is generated on UPS after that is run bat file on Windows 2003 , where are
> commands for safe shutdown of
> virtual disks and operating system and I need firstly from the same bat file
> safe shutdown MyApplication
> where is running in thread INSERTs commands and after that is starting timer
> which can be set from 1 to 99
> minutes and during this time I would like shutdown MyApplication ... and it
> run to round of course ..
> for example
> yyy.bat
> start "MyApplication" /min java -jar MyApplication.jar stop
>
> Have you any idea how it can do this ? I tried something but it didn`t work
> but I like to hear some other
> opinion.
>
> Thanks
>
>
Further to Paul's "run as a service" option, you might want to read this
article on BDN:
http://bdn.borland.com/article/0,1410,32068,00.html
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: Start and stop program from command prompt
Author: Paul Nichols [TeamB]
Date: Sat, 14 Jan 2006 06:37
Date: Sat, 14 Jan 2006 06:37
38 lines
2088 bytes
2088 bytes
Peter POCATKO wrote:
>
>
> Have you any idea how it can do this ? I tried something but it didn`t
> work but I like to hear some other
> opinion.
>
I do not know of any way you can do this from a batch file per se. The only
thing I can see is:
(1) You will need to configure Windows 2003 to stop this app from running.
You would have to set this up in :
The registry
As a Windows service
Put a COM wrapper around the batch file using Windows notification
API
Perhaps use JNI to write a C Routine to shut this down, again using Windows
Notification API.
If you were using Unix/Linux/Mac, you could probably do this from a shell
script. But without a full shell scripting language that has access to the
kernel APIs, I do not know how you could do this other than the methods I
described above,
Just remember, when you are wanting to use native OS operations, you have to
do some low level API work (unless, as stated you are using Unix or a Unix
derivative, where shell scripts give you additional power). Even on Unix,
you will invariably have to go outside Java or use JNI to call services or
Kernel/GDI apis direct.
Hope this helps!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads