Rick Koshi
Rick Koshi

Reputation: 955

How can I get Java to get preferences from an alternate location?

I'll preface this with two notes: 1) I know very little about Java. 2) What I am about to ask for is almost certainly a horrible hack.

I have an application I did not write, and I have no control over the code. It runs on (among other things) a Linux machine. It stores its preferences (presumably using the Preferences API, about which I know nothing) in a structure under $HOME/.java/.userPrefs/...

My problem is that I want to run more than one instance of this code, with different preferences in each instance. Is it possible to tell the Java interpreter to use an alternate location to store preferences, either using a command-line argument or an environment variable?


Edit: I'll add the additional stipulation that each of the instances needs to run under the same user, with access to the same (non-preferences) files.

Upvotes: 2

Views: 327

Answers (4)

Rick Koshi
Rick Koshi

Reputation: 955

The answer appears to be "it can't be done."

Upvotes: 0

dataoz
dataoz

Reputation: 118

You could potentially create different chroot's for every instance that you would like to run.

Upvotes: 0

Siva Arunachalam
Siva Arunachalam

Reputation: 7740

It's Simple. It seems be to be individual's user directory. Try running/execute the same program under different user accounts.

Upvotes: 2

tom
tom

Reputation: 2745

If you dont have access to the code to check how it really is working and it is saving the preference in a user folder I think your best bet is to run it as different users.

That being said, you can always decompile the code and try to find out if there are any options to pass a preference directory.

Upvotes: 1

Related Questions