• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you get the name from the executable?  RSS feed

 
Lori Cook
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off - I've looked for an answer to this, but have come up dry.

I've been tasked with, somehow, showing the name of the executable/jar file being run. There can be multiple jar files in the install directory (tagged with a revision number), any of which could have been started.

The product owner wants to see the name of the actual jar file started so that if the wrong one is being run, it can be discovered and stopped.

I've looked and looked but can't find anything that give me the name of the executable being run.

Help?

And option/advice welcome. Even a "it can't be done" would help me move forward.

Thanks
Lori <*>
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advice I could scrounge up on the web for questions like this was mostly to create a URI pointing to the jar file like this:



This will probably give you a URI which contains the name of the jar somewhere in it. You could have problems if that name contains spaces or other characters which aren't letters or numbers, but you could quite likely adapt that to produce something useful for your requirements.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compile this and run it from a command line with java -jar AppName.jar.

See if that gives you a lead.
 
Lori Cook
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes - that did give me a clue. :-)
Thanks
Lori <*>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!