We have a customer using a java based application which uses the default userfolder as working directory.
We found the option to add to the config file following command:
-Duser.home=C:\temp
Now this is working just fine, but we struggle to set the directory to another userspecific folder like %temp%. Is there a way to let java resolve windows system or user variables?
We can not use the default setting since all userfolders are redirected to a network share now when the users starts the application on his notebook and the terminal server there is a conflict due files that are already in use.
Yes. When I open a cmd prompt %temp% is set right.
If I put this in the config file of the java application (which was not written by us) it will create a folder named %temp% in the applications root directory.
I also tried things like:
-Duser.home=System.getProperty("user.home")
but then I get a folder named System.getProperty("user.home") in the root directory of the application (this test was to see if java will resolve variables).
Currently through a shortcut in the start menu.
I already played with command line options in the shortcut the problem is, that some users are used to launch the application from the installation folder by clicking on the exe file or create the shortcuts by themselves.
I also tried to use a batchfile which would look like this:
set _JAVA_OPTIONS=-Duser.home=%temp%
and the next step would be to run the application from that batch file. But then again, you would have to open exactly that batch file otherwise the application could run into troubles again.
the ini file looks like this atm and would be the perfect place to set the desired folder.
Since the application is running on a terminal server as well I have to use a folder which belongs to the user and he has write privileges in it.
Like %temp% or %userprofile%\foldername
I think there's a little confusion there. The citations are dealing with determining the locations of user.home in Windows, which is problematic. Your requirement was:
Now this is working just fine, but we struggle to set the directory to another userspecific folder like %temp%.
Sorry about the confusion.
My aim was to find a solution which would work all the time and not only if you click the right shortcut. But I did not mention that in the initial post. I thought this would be easier and java would have the ability to resolve variables set in the config file of the application.
During my research I found that java does not resolve the profile folder correctly (it uses the path of the desktop folder and goes one level up) which in our case is the network user home.
With the user environment variable this is fixed for the mentioned java application and all which would follow, that's why I didn't go with the shortcut solution.
So with the working environment set to:
-Duser.home=%HOMEDRIVE%%HOMEPATH% (C:\Users\Testuser) the path again is user specific (like %temp% no other standard users have access and its not shared with different sessions)
There is also a language barrier which prevents me from making myself fully understandable, I will try to ask more specific next time. Thanks
Cheers
Ben
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Open in new window