windows 显示java进程,在Windows上设置Java进程名称

Our Java Swing application is running on Windows and wrapped in an exe file using Launch4J.

We would like to customize our application process name and description (in Windows' task manager) as it is currently "javaw.exe" and "Java Platform SE binary" (which is confusing for our customers).

While older versions of Launch4J enabled to change this using , this option is now defunct as it is not working anymore as of Win7.

Is there any other (simple) workaround to customize our application process name and description?

For instance, changing javaw.exe executable filename seems like an approach (as we embed it in the wrapped exe file) but how then indicate to launch4j that the jvm file name changed?

Another option could be to create a launcher exe file: maybe an overkill?

Any ideas / hints are more than welcome; thanks!

解决方案

If you're looking to roll your own solution, you're going to want to look at JNI and the Invocation API in particular JNI_CreateJavaVM() which is used to create a VM, find the main method GetStaticMethodID() and invoke it with CallStaticVoidMethod.

This is what the java.exe, javaw.exe and a variety of other native launchers do internally. Some examples include:

If you want don't want to integrate a native build system with your java build system, an approach is to build a static launcher.exe in advance, and treat it as a static binary blob. Then during your java build, modify the binary blob using java, to update the VERSIONINFO, icon and splash screen. An example of this approach can be seen in IntelliJ LauncherGeneratorMain.java

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值