View Full Version : Locating user's current directory

09-15-2011, 01:31 AM
I have Java console program packaged using InstallAnywhere 2009 and the program is wrapped the using Launcher. Inside the program it access user's current directory using :

String path = ".";
String currentdir = File(path).getCanonicalPath();

I realized that the return value (currentdir) always repsected to the location of the wrapper program (i.e. c:\program files\myapp\bin if the wrapper is located in C:\program files\myapp\bin\myprog.exe). If path is absolute path then it is okay. How can I fix this to return the actual path from where the launcher is called?

Best Regards,


09-15-2011, 10:36 AM

I found my answer. If lax.user.dir is left blank, according to the manual, it will cause the native launcher to not
alter the platform default behavior for setting the user dir.
And this is exactly what I need.



06-13-2013, 09:45 AM
I am also facing quite similar issue when trying to fetch current director through my java custom code, there I am passing value using installerProxy.setVariable , but getting completely different value into my installer (C:\Users\ADMIN\AppData\Local\Temp\1371133525\Windows\null), but I am calculating currentDir through logic and that is coming correctly when tested locally but not coming same after send to installer.


I also tested with replace currentDir variable to any String "ABC" and unexpected this is working fine but I need to display calculated currentDir value into my installer which is not coming.. :mad:

Thanks in advanced...appreciate any kind of help!!