We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

matrim
Posts: 3
Joined: Thu Feb 16, 2006 7:20 am

Java Service Start Directory is \system32

I have a Java service that installs a DB on the initial run. I need to set the startup directory for the service to the application directory. Everything I have tried seems to have no effect; each attempt and the working directory is still the \windows\system32.

I'm sure there has to be a way to set the working directory to the application directory and I am just missing it. Some help on this would be appreciated.

I did read a post stating that, in this type of case, you should set the directory using the user.dir property. However this is still not adequate on Windows based machines due to how absolute pathnames are resolved. They are resolved against the current directory of the current drive first, then if that is not set the pathname is resolved against the user.dir setting. Because of this resulting ambiguity on intent when installing a service, the actual working directory should be able to be forced through the installer. Otherwise setting the user.dir will not change how relative pathnames are resolved for the service.

The information on path resolution can be found in the javadocs for File method getAbsolutePath().

The work around is to use user.dir to "fix" the relative to an absolute path. However, that kind of destroys the whole concept of relative paths.
Mihai
Posts: 38
Joined: Wed Mar 23, 2005 12:19 pm

Hi,

It is not recommended for an application to change the current directory because it could have a unexpected behavior for the user.

Also, a file path name which is relative to the program location should not include the drive.

However, your are right because the "user.dir" property does not totally replaces the working directory in the relative paths solving process.

For now, you can't change the working directory of a java product. We added this request on our list and it will included in a next version of Advanced Installer for Java.

Kind regards,
Mihai
Last edited by Mihai on Fri Feb 17, 2006 2:21 pm, edited 1 time in total.
Mihai Udrea
Advenced Installer Team
matrim
Posts: 3
Joined: Thu Feb 16, 2006 7:20 am

Thanks for the quick response. For now, I can let the directory stand as is. However, I will be looking forward to the fix- hopefully in the next release. The tool is well laid out- even us non-windows app developers can make sense of it in short time.

Return to “Common Problems”