This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

setting system envarioment variables in java  RSS feed

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys,
How do I set Enviroment variables(JAVA_HOME,MYSQL_HOME...) and different addresses in the system Path using java code?
Thanks

Yossi
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to do?

A process can only change the copies of the environment variables of itself and set the environment of child processes it might spawn, so setting them is fairly useless.
[ February 19, 2006: Message edited by: Joni Salonen ]
 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
All I'm trying to do is to set through the code different settings for JAVA_HOME and PATH.
I have an installation kit and each compter has different settings.
Now I use a setEnv.cmd file:
System\Service\setx JAVA_HOME c:\j2sdk1.4.2_02 -m
set JAVA_HOME=c:\j2sdk1.4.2_02
System\Service\setx MYSQL_HOME c:\mysql -m
set MYSQL_HOME=c:\mysql
System\Service\setx path "c:\j2sdk1.4.2_02\bin;c:\Eldat Common Path;c:\perl\bin;%path%" -m
set path=c:\j2sdk1.4.2_02\bin;c:\Eldat Common Path;c:\perl\bin;%path%;


The problem here is the static addresses, If I set it in the code it can be dynamic.

Can I do it?

thanks
Yossi
 
Joni Salonen
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really undestand the problem --- why don't you just make the part with for example "c:\j2sdk1.4.2_02" configurable instead of hardcoding it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!