B4J Question Java as Windows Service

Discussion in 'B4J Questions' started by pesquera, Apr 12, 2016.

  1. pesquera

    pesquera Active Member Licensed User

    Can somebody recommend to me some way to run a java program as a Windows/ service?
    It's a java (jar) server program, running fine into a windows' console.. now, it's required to be always on line..
    Thanks in advance
  2. tchart

    tchart Active Member Licensed User

    You need to use something like JavaService; http://forge.ow2.org/projects/javaservice/

    Are you wanting to run under 64bit? I can share my 64 bit copy of JavaService and my scripts to install a windows service if you want.
    jinyistudio and pesquera like this.
  3. tchart

    tchart Active Member Licensed User

    Just to add I tried several other service wrappers (some mentioned on this forum) but found JavaService the most reliable and easy to use.
    pesquera likes this.
  4. pesquera

    pesquera Active Member Licensed User

    yes, it's w2008 server 64 bits.. I appreciate so much your help, thanks!
  5. tchart

    tchart Active Member Licensed User

    Ok, I've put it on Dropbox;


    The zip file contains the x64 version of JavaService.exe, msvcr100.dll (required for JavaService.exe) and two batch files.

    The two batch files are to install and uninstall the service you will need to tweak these with your config. Note the batch file sets the service to "Manual" so you may want to change that to automatic.

    The JAR file needs to be in the same directory as the other JavaService files.

    Most important tips are to make sure you point at the correct JVM.dll file (ie 64bit) and also name your start entry point correctly with your package name plus ".main"

    eg; -start com.mypackage.main

    If you mix bits (ie 32bit JVM with 64 bit JavaService) it will not work. Also if the package name is wrong it will not work.
    Last edited: Apr 13, 2016
    JakeBullet70, JCO, billzhan and 3 others like this.
  6. pesquera

    pesquera Active Member Licensed User

    yes! excellent!! it' s working like a charm.. thanks so much!!
    tchart likes this.
  7. micro

    micro Well-Known Member Licensed User

    Hi tchart
    the file on Dropbox has been removed.
    you can put it again?
  8. OliverA

    OliverA Well-Known Member Licensed User

    micro likes this.
  9. tchart

    tchart Active Member Licensed User

    rraswisak and MauSan like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice