Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - create a new windows (xp) service that runs a jar file

 
Thread Tools Search this Thread
Old 07-05-2006, 10:33 AM   #1
Default create a new windows (xp) service that runs a jar file


Hello guys,

Does anyone has experience/know how to create a new windows (xp)
service that runs a jar file? This issue rises as i need to hide the
most of the java implementation in this project before it goes live.

So the idea is, to have control on the exceution of the jar from
windows windows service console (which the users can define the startup
type i.e. manual, automatic, disabled and the running life cycle i.e.
start, stop, pause, resume, restart...).

so any leads to solving this will be appreciated.

Thanks in advance. Have a nice day!



JPractitioner
  Reply With Quote
Old 07-05-2006, 03:41 PM   #2
dsjoblom@abo.fi
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
JPractitioner wrote:
> Hello guys,
>
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.
>
> So the idea is, to have control on the exceution of the jar from
> windows windows service console (which the users can define the startup
> type i.e. manual, automatic, disabled and the running life cycle i.e.
> start, stop, pause, resume, restart...).
>
> so any leads to solving this will be appreciated.
>
> Thanks in advance. Have a nice day!


I imagine you would create it like any other windows service. See
http://support.microsoft.com/kb/q137890/

Regards,
Daniel Sjöblom



dsjoblom@abo.fi
  Reply With Quote
Old 07-05-2006, 05:35 PM   #3
Real Gagnon
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.


Use the "Java Service Wrapper"

http://wrapper.tanukisoftware.org/do...n.html#service

Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html


Real Gagnon
  Reply With Quote
Old 07-07-2006, 02:44 PM   #4
JPractitioner
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
thx to the both of u.
i really appreciate..
good luck and all the best!


Real Gagnon wrote:
> > Does anyone has experience/know how to create a new windows (xp)
> > service that runs a jar file? This issue rises as i need to hide the
> > most of the java implementation in this project before it goes live.

>
> Use the "Java Service Wrapper"
>
> http://wrapper.tanukisoftware.org/do...n.html#service
>
> Bye.
> --
> Real Gagnon from Quebec, Canada
> * Looking for Java or PB code examples ? Visit Real's How-to
> * http://www.rgagnon.com/howto.html




JPractitioner
  Reply With Quote
Old 07-20-2006, 11:41 AM   #5
JPractitioner
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
Hi Daniel, I followed your way.
I just dont know how to start with java service wrapper. realgagnon
might have some idea on this that he can share with us?

So back to the topic, I managed to add a new service on my pc and it
shows in my services applet. But the service cannot run a jar file, it
throws error that says the service has been stopped because it is
inactive. Actually the program is active. It listens to client's
requests once started. It takes some configuration value from a few
files.

Anyway, i figured out that, windows might expect an exe instead of jar
to execute. So i tried to convert the jar to exe. I did that and the
exe can run. Following that, I edit my registry.. pointing the value
data to the exe i made.

I try again, this time i can see my program's console for a while and
then my program throws error saying that it cannot get the file as if
the file was not even there.

This is weird since i can run the program perfectley with the jar and
the exe but when it involves windows service to run the exe, the file
not found error slap me right on my face.

So, dsjoblom.. /other readers, do u have any idea why this happened and
how i can solve this?

Thinking of other alternatives, I will just copy a shortcut to my
startup folder, but this wont do very well since someone (administrator
in my case) has to log on before the system can run. The administrator
account will have to log on forever... or I might have to consider
another user account dedicated to this thing hmmmm......

ok guys, thanks.

wrote:
> JPractitioner wrote:
> > Hello guys,
> >
> > Does anyone has experience/know how to create a new windows (xp)
> > service that runs a jar file? This issue rises as i need to hide the
> > most of the java implementation in this project before it goes live.
> >
> > So the idea is, to have control on the exceution of the jar from
> > windows windows service console (which the users can define the startup
> > type i.e. manual, automatic, disabled and the running life cycle i.e.
> > start, stop, pause, resume, restart...).
> >
> > so any leads to solving this will be appreciated.
> >
> > Thanks in advance. Have a nice day!

>
> I imagine you would create it like any other windows service. See
> http://support.microsoft.com/kb/q137890/
>
> Regards,
> Daniel Sjöblom




JPractitioner
  Reply With Quote
Old 07-20-2006, 11:46 AM   #6
JPractitioner
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
guys, when i meant "files".. they are the configuration files that feed
the configuration value such as remote address and so on...



JPractitioner wrote:
> Hi Daniel, I followed your way.
> I just dont know how to start with java service wrapper. realgagnon
> might have some idea on this that he can share with us?
>
> So back to the topic, I managed to add a new service on my pc and it
> shows in my services applet. But the service cannot run a jar file, it
> throws error that says the service has been stopped because it is
> inactive. Actually the program is active. It listens to client's
> requests once started. It takes some configuration value from a few
> files.
>
> Anyway, i figured out that, windows might expect an exe instead of jar
> to execute. So i tried to convert the jar to exe. I did that and the
> exe can run. Following that, I edit my registry.. pointing the value
> data to the exe i made.
>
> I try again, this time i can see my program's console for a while and
> then my program throws error saying that it cannot get the file as if
> the file was not even there.
>
> This is weird since i can run the program perfectley with the jar and
> the exe but when it involves windows service to run the exe, the file
> not found error slap me right on my face.
>
> So, dsjoblom.. /other readers, do u have any idea why this happened and
> how i can solve this?
>
> Thinking of other alternatives, I will just copy a shortcut to my
> startup folder, but this wont do very well since someone (administrator
> in my case) has to log on before the system can run. The administrator
> account will have to log on forever... or I might have to consider
> another user account dedicated to this thing hmmmm......
>
> ok guys, thanks.
>
> wrote:
> > JPractitioner wrote:
> > > Hello guys,
> > >
> > > Does anyone has experience/know how to create a new windows (xp)
> > > service that runs a jar file? This issue rises as i need to hide the
> > > most of the java implementation in this project before it goes live.
> > >
> > > So the idea is, to have control on the exceution of the jar from
> > > windows windows service console (which the users can define the startup
> > > type i.e. manual, automatic, disabled and the running life cycle i.e.
> > > start, stop, pause, resume, restart...).
> > >
> > > so any leads to solving this will be appreciated.
> > >
> > > Thanks in advance. Have a nice day!

> >
> > I imagine you would create it like any other windows service. See
> > http://support.microsoft.com/kb/q137890/
> >
> > Regards,
> > Daniel Sjöblom




JPractitioner
  Reply With Quote
Old 07-20-2006, 02:50 PM   #7
bowman
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
JPractitioner wrote:

> I try again, this time i can see my program's console for a while and
> then my program throws error saying that it cannot get the file as if
> the file was not even there.


Where is it looking for the file? Services inherit from the SCManager and
often act as if the cwd is %WINDIR%\system32. I am not familiar with the
Java wrapper and don't know what tweaking it might do as the process is
spun up by the SCManager. If you are using a relative path, try an
absolute.

As a service is started, The SCManager expects feedback from the new thread
on a timely basis saying "I'm still trying to get it together", "I'm good
to go", and so forth and assumes it is not running if the reply isn't
received, but the wrapper should be taking care of this housekeeping.




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


bowman
  Reply With Quote
Old 07-20-2006, 02:57 PM   #8
Luc The Perverse
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
"JPractitioner" <> wrote in message
news: oups.com...
> Hello guys,
>
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.
>
> So the idea is, to have control on the exceution of the jar from
> windows windows service console (which the users can define the startup
> type i.e. manual, automatic, disabled and the running life cycle i.e.
> start, stop, pause, resume, restart...).
>
> so any leads to solving this will be appreciated.
>
> Thanks in advance. Have a nice day!
>


If you really need to run a Java program as a Windows Service you might want
to natively compile it.

I know excelsior Jet professional has a windows service native compilation
option.

(I think Jet is the only byte code to windows code converter that is still
around and up to date.) There is a GNU byte code to Linux binary compiler.

--
LTP






Luc The Perverse
  Reply With Quote
Old 07-20-2006, 04:28 PM   #9
JPractitioner
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
Hi bowman,
After i read your comment, i realized that those file were refered
relatively. So i changed them to an absolute path. and it
<b>WORKS!!!!!</b>

thanks man for teaching me this.

however, some xml files were also out of reach.. and the error said
that the xml cant be found in c:\windows\system32

so i place the xml files there, and its working.

I have one more question.. why is that when i stop the service, only
srvany.exe being killed.. but my app still alive? and also if i kill my
app, the srvany.exe still alive.. why is it like this?

Again, thanks a lot bowman, the tips u gave is the key that i will use
to learn more about windows.

Thanks,
Makmur.


bowman wrote:
> JPractitioner wrote:
>
> > I try again, this time i can see my program's console for a while and
> > then my program throws error saying that it cannot get the file as if
> > the file was not even there.

>
> Where is it looking for the file? Services inherit from the SCManager and
> often act as if the cwd is %WINDIR%\system32. I am not familiar with the
> Java wrapper and don't know what tweaking it might do as the process is
> spun up by the SCManager. If you are using a relative path, try an
> absolute.
>
> As a service is started, The SCManager expects feedback from the new thread
> on a timely basis saying "I'm still trying to get it together", "I'm good
> to go", and so forth and assumes it is not running if the reply isn't
> received, but the wrapper should be taking care of this housekeeping.
>
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----




JPractitioner
  Reply With Quote
Old 07-20-2006, 04:30 PM   #10
JPractitioner
 
Posts: n/a
Default Re: create a new windows (xp) service that runs a jar file
Thanks Luc, I'll take a look of this software,,


Luc The Perverse wrote:
> I know excelsior Jet professional has a windows service native compilation
> option.
>




JPractitioner
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Reset / Recover Forgotten Windows NT / 2000 / XP / 2003 Administrator Password wskaihd Software 2 11-17-2009 02:01 AM
How to activate Remote Assistance with XP using Windows Live Messenger Oziisr General Help Related Topics 0 02-01-2008 04:45 PM
Computer Security aldrich.chappel.com.use@gmail.com A+ Certification 0 11-27-2007 02:11 AM
Re: fat32 converter for windows me Bum A+ Certification 0 03-04-2005 11:13 PM
Re: Ripping DVDs. Please answer the attached question. - Question.txt Stan Brown DVD Video 19 02-09-2005 11:19 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46