This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Locating user's current directory
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 15, 2011
01:31 AM
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
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
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 15, 2011
10:36 AM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 13, 2013
09:45 AM
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!!
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!!
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)