Java Service Wrapper Executable Runnable Jar

后端 未结 3 1285
执笔经年
执笔经年 2021-01-22 15:18

WrapperAppJar I am wrapping an executable runnable jar file as a window service. Based upon the tutorial on Tanuki software site I export my app from eclipse as an executable ja

相关标签:
3条回答
  • 2021-01-22 15:44

    You can use other executable wrapper

    • Launch4J - Download

    • JSmooth - Download

    Other options are also available :)

    0 讨论(0)
  • 2021-01-22 15:47

    Is a value missing for the port option? You say that your jar is run as:

     java -jar smpp-portal -port 90
    

    However, the wrapper config doesn't seem to have the port number as an application parameter:

    # Application parameters.  Add parameters as needed starting from 1
    wrapper.app.parameter.1=../lib/smpp-portal.jar
    wrapper.app.parameter.2=-port
    
    0 讨论(0)
  • 2021-01-22 16:00

    unhillbilly has a good point. But actually it's not the real reason for the error you are seeing. Basically the manifest file in your jar file appears incorrect.

    When you created the jar file, you were probably exporting your project from eclipse as runnable jar and selected as library handling to package the required jar files into the generated jar...

    So by doing this Eclipse is using the class JarRsrcLoader.

    This class is in fact the main class of your executable jar and not as you might thought your main class.

    JarRsrcLoader requires 2 parameters being set in the manifest file: Rsrc-Main-Class and Rsrc-Class-Path.

    Rsrc-Main-Class is the class name of your actual main class.

    Rsrc-Class-Path is the class path (with all included jar files in the jar file) to launch your application.

    Your manifest file appears to miss those 2 properties.

    So you can resolve this by changing the way how you are exporting the jar file, for instance use "extract required libraries in jar". Another option would be to add the 2 missing properties into your META-INF/manifest.mf file.

    0 讨论(0)
提交回复
热议问题