title: Best way to set environment variables for java program?
body: <p>I am writing a Java program that uses the RJava interface (<a href="http://rforge.net/rJava/" rel="nofollow">http://rforge.net/rJava/</a>). Because this allows using R inside of a Java program, I have to make sure the proper environment variables are set when a user tries running this program. </p>
  
  <p>My question is, what is the best way to set these variables? Should I just write a script to set them before the program is executed? The problem with that is, I have to ask the user which directory R is installed in as well as where their R libraries are stored, since the user could really have put this anywhere. I don't think there is any way around that since I need to update the PATH variable with that information for RJava to work correctly and be able to run R and it's libraries within my program. </p>
  
  <p>I get nervous permanently modifying the PATH variable for a user, but I guess other installers for programs do this all the time... </p>
  
  <p>Any suggestions on the best way to make all of this work together well? </p>