简体   繁体   中英

java application as a Windows Service using C#

I would like to wrap a java application as a Windows Service using C#. I can do it easily using the Process class and calling Process.Start("java.exe", "args") , but doing this way I have 2 process, my service wrapper and the java process. I'm looking to fully wrap the java application, including the java process.

Does anybody here has done it or knows the best way to do this in C#?

The two basic approaches are to either run the Java application as a separate process, or to host the JVM directly, and use it to launch your application. There isn't a direct way to do this in C#, as the JNI interfaces for hosting are C++ interfaces only.

However, there are commerical products that allow you to do this directly from Java.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM