wood burning stoves*
The moose likes Java in General and the fly likes MyJar.jar gives process name as java.exe on windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "MyJar.jar gives process name as java.exe on windows" Watch "MyJar.jar gives process name as java.exe on windows" New topic
Author

MyJar.jar gives process name as java.exe on windows

jaibhim max
Greenhorn

Joined: Nov 15, 2010
Posts: 21
Hi All,

I have one executable jar e.g. "MyJar.jar". When I run this jar on linux machine, I am able to figure it out that this jar is running or not as-


But when I run this jar on windows, then I see only java.exe as running process.

Is there a way by which I can identify on windows whether MyJar.jar is running or not?


Thanks,
jai
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Use Process Explorer instead of the Windows Task Manager. It will still show up as "java.exe" or "javaw.exe", but if you right click on these and select Properties you can see the entire command line that was used to create the process.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jaibhim max
Greenhorn

Joined: Nov 15, 2010
Posts: 21
Hi Rob,

Thanks for the info, but I cant expect my application users to install "Process explorer". Is there any another way?


-jai
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

What do you want to do with the process?
jaibhim max
Greenhorn

Joined: Nov 15, 2010
Posts: 21
I want to allow only one instance to be running of my jar...So, I am checking for the process, if that process is already running then I will pop-out the error message to user stating that , "another instance of Myjar.jar is running"


-akash
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

If you use our search you will find a few threads about the same issue. Some have listed a good few techniques for doing this.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MyJar.jar gives process name as java.exe on windows
 
Similar Threads
Mistake in GuideBook for SCJP Java 6.0, Chapter 10, Self Test question 11
Doubt in K&B Self Test from Last Chapter
question reg jar file
tomcat5, server not found
Help! Accessing files in a JAR file at Runtime