• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting environment variables persistently (in a way like java.util.prefs)

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

java.util.prefs offers a plattform independent way to make settings persistent (registry, prop-files etc., depends on JRE implementation). is there a way to make system environment variables like $PATH persistently with java?
i know java is not meant to make platform specific stuff but in my opinion the API could do such a thing not too much different to java.util.prefs. you write with java platform independently that you want to set environment variables (which AFAIK exist on all plattforms) and JRE implementation chooses the way how these settings are accomplished.

the reason why i need this is that i am using an installer written in java which needs to set the $PATH variable persistently. i chose java for my installer because it not only needs to set $PATH, merely it is doing other java specific stuff too.

thanks.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Environment variables don't exist on all platforms, and don't have the same semantics when they do; and of course not every program has necessary permissions to change environment variables. That's why Java does things with system properties and other mechanisms.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic