Converting a war file into an executable file

前端 未结 2 1750
旧巷少年郎
旧巷少年郎 2021-01-14 16:58

My company has developed a web application (J2EE environment/Tomcat server) and wants to sell it as a product. Customers can avail this product as basic edition or premium e

2条回答
  •  借酒劲吻你
    2021-01-14 17:39

    How do we convert a war file into an exe file and embed logic to distinguish premium or basic version.

    These are 2 distinct requirements which have nothing to do with each other.

    If you have a web application you can either enter the serial key using a web page (like Jira does for instance), or you could perhaps let the key (or the filename of the keyfile) be written in Context.xml, and let a servlet read that context parameter. Based on the key the application could then allow or not allow some functionality.

    As for converting to an executable, there are multiple interpretations to the word executable. I for one think "war" file is executable enough - dump it in a tomcat and it runs.

    If you want it standalone you could provide a tomcat distribution with your app predeployed (again, like Jira does), or use a Jetty embedded container. Although that may not be appropriate for heavy workloads.

    You could even try to convert jetty + your web app to a native exe using gjc (Gnu Java Compiler) though I doubt it will work as well as the normally deployed version.

    I'd advise you to either inject the key via context parameters, or create an admin page n which you can enter the key.

提交回复
热议问题