Environmental Variables in Java Program


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Environmental Variables in Java Program

Hybrid View

  1. #1
    SNP Guest

    Environmental Variables in Java Program


    Can we pull out the environmental variables and their associated value which
    are set in the Operating System to our java program?

    eg: in one MS DOS window I set,

    set xyz="Just For Testing";
    set path="c:\jdk1.2.2\bin;

    can I read the value of the above 2 environmental variables in a java program
    which I execute in the same window?

    I tried, System.getProperties(), It returns only some std env variables...

    SNP

  2. #2
    Ruchi Dhar Guest

    Re: Environmental Variables in Java Program


    You can't access all the environment variables from System.getProperty method.
    Only thing is you write either a native 'C' program or a batch program which
    can take input parameter and prints the value. You can use Runtime class
    to execute the shell or exe file and read the output from the Process.


    "SNP" <shankar1972@yahoo.com> wrote:
    >
    >Can we pull out the environmental variables and their associated value which
    >are set in the Operating System to our java program?
    >
    >eg: in one MS DOS window I set,
    >
    >set xyz="Just For Testing";
    >set path="c:\jdk1.2.2\bin;
    >
    >can I read the value of the above 2 environmental variables in a java program
    >which I execute in the same window?
    >
    >I tried, System.getProperties(), It returns only some std env variables...
    >
    >SNP



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center