cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ben2011
Level 3

Locating user's current directory

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,

Ben
Labels (1)
0 Kudos
(2) Replies
ben2011
Level 3

Hi,

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.

Thanks!

Ben
0 Kudos
dheeru
Level 2

Hi,
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.

installerProxy.setVariable("$CURRENT_DIRECTORY$",currentDir);

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!!
0 Kudos