Fuangwith S.
Fuangwith S.

Reputation: 5764

How to rename java.exe/javaw.exe process?

Always when I run java application it will display in Windows Task Manager is java.exe or javaw.exe. How to rename java.exe or javaw.exe process without wrapper by other programming languages.

Upvotes: 18

Views: 14028

Answers (7)

jbilander
jbilander

Reputation: 651

Old thread but if anyone still wonders...If you use the javapackager with the -name MyTestApp -native image flags it will generate a native runtime image with the executable MyTestApp.exe for you and this is how it will look like in the Task Manager with the default icon:

task_manager_screenshot

Now, packaging as a Self-Contained Application may or may not be what you want. It has both benefits and drawbacks: https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#A1307236

Upvotes: 1

jefferycn
jefferycn

Reputation: 11

There are mainly 2 approaches: one is as others described: using Launch4j, WinRun4J to create native Windows launchers.

Another approach that seems better is to use Apache Procrun to wrap the java application as a Windows service. During the install service process, we can give the process an meaningful name such as OurApp.exe.

All we need do is rename prunsrv.exe to OurApp.exe and replace every occurrence of prunsrv.exe in our install|start|stop|uninstall service scripts to MyApp.exe.

See more from Using Apache Procrun to Rename Process Name of a Java Program in Windows

Upvotes: 1

volley
volley

Reputation: 6711

I suspect operating systems are generally not very fond of processes trying to rename their "image". If this was possible it would for instance be very easy for a virus to impersonate a legitimate process.

By the way, you can also use "jps.exe" to list all Java processes and their corresponding main class. "jps.exe" is found in the bin directory of your Java installation.

Upvotes: 5

Fuangwith S.
Fuangwith S.

Reputation: 5764

In easy way and badly style, you can copy java.exe or javaw.exe (execute file) and rename to new process name that you want.

Upvotes: 5

gimel
gimel

Reputation: 86364

If you are confused by looking at process names that are all the same (java.exe), try to use Process Explorer instead of Task Manager, and display the command line field. This way, you can see the class or jar arguments that differentiate one process from another.

Upvotes: 15

Michael Myers
Michael Myers

Reputation: 191875

I believe your best bet is to use an ahead-of-time compiler like Excelsior JET to produce an executable. As they mention, you could also use a custom laucher or wrapper instead.

Upvotes: 3

johnstok
johnstok

Reputation: 98210

You could use jSmooth:

JSmooth is a Java Executable Wrapper. It creates native Windows launchers (standard .exe) for your java applications.

Upvotes: 7

Related Questions