How to find an application installation path directory with java

I have installed my jar application using packjacket, an installer generator.

default installation path will be in "../program files/myapp.jar"

but how can java language detect different installation path if user decide to change to different path directory during installation. (currently i just hard code the default location as C:/../program files/)

i have read this question, How to find an application installation path in the ms windows registry via EXE name. But regrettably still not understand.

ps: im not sure if my jar application have registry path or not because i rely on packjacket installer to install my apps.

this reference is unclear: find the path of my application installed in registry


Your question is a little unclear.

Your application should never make assumptions about where it might be stored and should rely on relative paths or know variable paths, such as the user's home directory (System.getProperty("user.home")).

You can find you current "working" directory using System.getProperty("user.dir")

Need Your Help

Community Sqlite NOT Handling Dates & DateTimes Correctly

sqlite mvvmcross

It seems that this new version is not handling dates correctly. Please see the below observations:

Crawling hidden data using Scrapy

python python-2.7 xpath web-scraping scrapy

I just started crawling. I'm trying to crawl question and answers from website by downloading content using Scrapy framework and Python 2.7. I