Forum Stats

  • 3,759,052 Users
  • 2,251,495 Discussions
  • 7,870,477 Comments

Discussions

How to executable Java application as a service in either Win98 or WinNT

843798
843798 Member Posts: 24,864
edited Jun 29, 2001 4:24AM in Java Runtime Environment (JRE)
I've written a series of Java programs that will extract info from a web page and perform updating on an Microsoft Access database.

How can I 'convert' this Java program to run as a service in Win98 or WinNT automatically?

This Java program would also execute every 5mins to perform the extraction and other functions. I'm using the Timer class to delay the execution, is there any other method of doing this? And finally, is there any way where by I can instruct this Java program to run only during a certain period of time, let said between 8am to 5pm?

Pls help!!

Comments

  • 843798
    843798 Member Posts: 24,864
    Hi,
    Its very simple.

    This is what i could have done in your case.

    -> Write the command for executing your program in autoexec.bat

    -> For efficiency purpose, make your first class which is loaded, a little bit small. That class will check the time and will stay activated if it is btw 8 and 5.


    Simple !!!! :-)

    luv
    goldy
  • 843798
    843798 Member Posts: 24,864
    Care to show me some of your code, especially on the second part.
  • 843798
    843798 Member Posts: 24,864
    U can certainly achieve this but with a non traditional technique-:).Use the task scheduler to schedule the execution times and other parameters for your program.
  • 843798
    843798 Member Posts: 24,864
    I was just wondering if I'll to made used of the scheduler to schedule my Java program to execute at a specific time, would this work if the user is not log-in, especially for WinNT?
  • 843798
    843798 Member Posts: 24,864
    you can use autoexe.bat file and set the echo parameter to off for console not to be displayed. And use javaw instead of java for interpreting the programme.

    You can make your application to sleep for specified time interval

    Hope it will solve your problem

    Satish
  • 843798
    843798 Member Posts: 24,864
    There a couple service installers that I know about
    http://www.kcmultimedia.com/javaserv/\
    http://www.alexandriasc.com/software/JavaService/index.html


    There is also a bug you should know about.
    http://developer.java.sun.com/developer/bugParade/bugs/4323062.html
  • 843798
    843798 Member Posts: 24,864
    Hello,

    You can easily make a NT service out of anything with SRVANY.EXE. I had it on my PC and the documentation was in MSDN. If you don't have it it must be in some dev. kit from Microsoft.

    The only problem with that is if you want to be able to log off (not shutdown !) and have the service still running. For that you first need of course to set the service so it uses its own account. And you will need to use JVMI.EXE instead of JAVA.EXE which was said to not survive to the log off (I don't know if it is true but I use JVMI.EXE and it works fine)

    Do not hesitate to send me a mail if you need more info: [email protected]

    Cheers,
    Pierre
This discussion has been closed.