Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / September 2004

Tip: Looking for answers? Try searching our database.

Problem using Eclipse

Thread view: 
Mahesh S - 23 Sep 2004 16:23 GMT
I am trying to read environment variables in Java using
System.getProperty(). I run java as

set myvar="XYZ"
java -Dmyprop="%myvar%"

and if I run following code from command line it works:

public class ABC {
    public static void main(String[] args) {
        System.out.println(System.getProperty("myprop"));
    }
}

However, if I run this through Eclipse then it prints "%myvar%"
instead of "XYZ".

Any solution?

--
Mahesh Soundalgekar.
e-mail: soundalgekar@yahoo.co.uk
John  Keyes - 23 Sep 2004 18:09 GMT
Mahesh,

Do you want to run an application in Eclipse and get it to pick up the
value of an environment variable you have set?  If this is the case
then you are out of luck.  When you launch an application from Eclipse
a new JVM is created, therefore even if you do pass properties to the
eclipse launcher (-vmargs -Dmyprop="%myprop%") they will not be visible
to the new JVM.

If you just want to test system properties you can do this from the
"Run..." dialog.  There is an "Arguments" tab which allows you to
specify program and VM arguments.  You can add your -Dmyprop="xxx"
here.  You will have to supply the value yourself, as I mentioned
earlier you cannot reference the system environment.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.