Setting a system.property twice in a same JVM

Hello,
I have got a problem concerning the setting of a system property.
When I run a first time my program I test a case by setting a system property, that works fine.
Now I want to change the same property in the same JVM by doing:
System.setProperties("key","oldvalue");
System.getProperties("key", "oldvalue"); //I obtain oldvalue
System.setProperties("key","newvalue");
System.getProperties("key", "newvalue"); //I obtain newvalueBut apparently it seems the JVM doesn't take the new value of the property even if the getProperty() give me the new value.
So my question is can I change several times the value of a same property in the same JVM or it is technically not possible?
I read the tutorial about System and it says :"The setProperties method changes the set of system properties for the current running application "
Thank you for any assistance

And I say that it apparently does not work because I run some tests
to find why my results were wrong even if in setting a new property.Well, one of those tests might be to just check the changed property right after the change.
Which you do in your code.
And which results in a correctly changed property, doesn't it?
So, what are those other tests you've performed, what was it that you've expected them to do and what did they actually do?
So it is just because if you have initialized the system property once you
cannot do it again or you have to record the new value in a file and then restart
your application by take the value of the system property inside the previously created fileNone of both. You can just change the system properties (just like every other properties) and the changes take place immediately (unless you run multithreaded, in which case you should put the "setproperty" stuff into a synchronized block or method.
Of course, if you try and change the properties of your operating system, then that's different. But I won't start and guess around about what exactly you try to do and what does not work.
Again, try to state plainly
1.) what you programmed, perhaps with some line of code
2.) what you expected your code to do
3.) what happened instead
Provided with that information, forum readers should be able to provide you with some help.
-T-

Similar Messages

  • How to set a system property via the config tool?

    Hello,
    how can I set a system property via the config tool? Before I chose WAS from SAP I used java with option -D<name>=<value> to set the system properties.
    Very much thanks in advance.
    Regards
    Carsten

    Hi Carsten,
    WAS config tool is located under
    e.g. usr\sap\J2E\JC00\j2ee\configtool
    start configtool.bat
    there will be opened a configuration tool GUI
    Click on the instance_ID.... leaf of the tree in the left pane and then on the server_ID.... leaf.
    Java settings will appear in the right pane after this steps.
    Best Regards,
    Violeta

  • How to set my System Property for frmall.jar like !

    I have a JAR file named SecAuth.jar in ORACLE_HOME\forms\java\ directory.
    I configured this JAR file in ORACLE_HOME\forms\server\formsweb.cfg file archive tag. Like,
    archive=frmall.jar,SecAuth.jar
    Its working very nice.
    Now I need to give a System Property to one of the Class file in the SecAuth.jar !
    Actually my System Property is,
    -Dproject.system.securityFile=C:\client\security.properties
    How can I do this sir ? Can someone help me ?

    Try looking in the $ORACLE_HOME/opmn/conf/opmn.xml file. You'll see a set of process definitions that correspond to the OC4J instances you have configured. There should be a "start-properties" or some similar element to that, in which you can place your required System property. There should be examples of properties in there already.
    When OPMN starts your OC4J process, it will pass it the System property you set (along with all the other ones that were already there).
    -steve-

  • Setting Derby system property in Sun Application Server batch file

    Hi all,
    I am trying to set up a home directory for my Derby databases other than the default C:\Sun\AppServer\lib that is used when asadmin.bat runs.
    I have found in the derby documentation you can set the derby.system.home System Property using -Dderby.system.home="C:\databases" and I have tried to do this in the asadmin.bat file next to all the other system properties containing the -D option.
    But still no luck, when I load the server using asadmin and check the server log file I can tell the property is not being set. I can also tell its not being set because I can't ping my database connection in the admin console. Any ideas anyone?
    Much appreciated,
    Alman

    Here is what I tried.
    No jndiname works but when I leave the value empy I get the result (see end)
    Properties props = new Properties();
    props.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
    props.put("java.naming.provider.url", "iiop://localhost:3700");
    InitialContext initialContext = new InitialContext(props);
    //queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup( "jms/qschdinfact");
    //queue = (Queue)initialContext.lookup("jms/qschdin");
    Enumeration en = initialContext.listBindings("");
    while(en.hasMoreElements()) {
    Binding b =(Binding)en.nextElement();
    System.out.println(b);
    ServerObject: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    intakefacade: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    commonfacade: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    J2EE_UNIQUE_VALUE_GEN: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    trackfacade: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    hsface: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    DatabaseInformation: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    Realm_Manager: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    SerialContextProvider: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    usergroups: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    intakereporter: com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1:com.sun.corba.se.internal.iiop.CDRInputStream_1_0
    Help please

  • Setting the system property in java application

    Hi,
    I want to make a connection to https://URL through my java application class
    which will be deployed in the weblogic server. Could any one help by
    telling how could I set the system properties in my java application. If I
    pass the value in the java class do I have to change any value in the
    weblogic.properties file.
    Thanks in advance and looking forward to hear your valuable suggestion.
    Sirisha

    System.getProperty(..)
    System.setProperty(..) is this what you are asking for?
    This gets and sets the system (your machine) environment properties
    Filip
    In article <396d0a93$[email protected]>, [email protected] says...
    >
    Hi,
    I want to make a connection to https://URL through my java application class
    which will be deployed in the weblogic server. Could any one help by
    telling how could I set the system properties in my java application. If I
    pass the value in the java class do I have to change any value in the
    weblogic.properties file.
    Thanks in advance and looking forward to hear your valuable suggestion.
    Sirisha
    Filip Hanik
    Software Architect
    XMarkstheSpot.com
    [email protected]

  • Setting up java.system.property in WL 6.0

    Hi all,
    I just installed Web Logic 6.0. I would like to know if anyone knows how
    to set java.system.property in Web Logic 6.0
    In old Web Logic 5.1, I added this line in weblogic.properties file. Now
    since we don't have weblogic.properties file anymore, I am assuming this
    should go in config.xml. Documentation says I should use Admin Console
    to modify config.xml and to convert old weblogic.properties file, but I
    found Admin Console confusing.
    My Web Logic 6.0 is installed on d:\bea\. I clicked on Convert
    Weblogic.properties and I see directories on my system. I click on icon
    to get the directory that has weblogic.properties file. Then I get page
    that ask me to pick Clusters and Server and I have no idea what
    directory I need to click on
    If someone knows what to do next or how to edit Config.xml so that I can
    add my java.system.property, please e-mail me
    Thanks in advance
    Qaiser

    Did you see the directions on page 3-11 of the WLS 6.0 Administration Guide? I
    followed these steps, and was able to create a new domain. I found them to be
    clear.
    Laurel
    "Jesper de Jong" <[email protected]> wrote:
    >
    Hello all,
    Instead of working with "mydomain" and "myserver" I want to create my
    own domain.
    IMHO, the documentation on e-docs is not very clear on the steps that
    are necessary
    to do this.
    What are the steps, or where can I find better documentation on creating
    a domain?
    regards,
    Jesper

  • How can I set jbo.sql92.LockTrailer system property in BC4J?

    We are using BC4J in 'SQL92' SQLBuilder mode and using MySQL database. row.lock() is not really locking the row. It seems, we need to set jbo.sql92.LockTrailer to correct value so that it will issue correct SQL statement for locking the row. How can I set this system property?

    Apparently this has something to do with the content of the TextObject. I added a new TextObject called "TestText" and put "this is test text" into it. I am able to set the value on that TextObject with no issues. But if the TextObject contains any formulas (Text4 in the sample below) the set throws an error, even if I try to set the Text to "" .
    foreach (ReportObject ro in letter.ReportDefinition.ReportObjects)
                        if (ro.Name == "TestText" || ro.Name == "Text4")
                            TextObject textObj = (ro as TextObject);
                            string oldText = textObj.Text;
                           // string oldText = "";
                            textObj.Text = oldText ;
    These reports are imported from CR9.2, does that have anything to do with it?

  • Java.system.property

    I repost Craig Sandin's question, which was post on Feb 06th. I have the same problem
    as him.
    I have used java.system.property in my wls 5.1 weblogic.properties file, and it
    set a system property I could get at runtime. Is there an equivalent in wls 7.0?
    I haven't found anything in the documentation for config.xml. Obviously I can
    pass -D options to the jvm, but I was looking for a way from the config file.
    hongjie

    We don't offer this anymore.. Sorry.
    You could write your own very simple
    wrapper class to start WLS:
    Properties props = new Properties();
    props.load(new FileInputStream("weblogic.properties");
    System.setProperties(props);
    weblogic.Server.main();
    Cheers
    mbg
    "hongjie" <[email protected]> wrote in message
    news:[email protected]..
    >
    I repost Craig Sandin's question, which was post on Feb 06th. I have thesame problem
    as him.
    I have used java.system.property in my wls 5.1 weblogic.properties file,and it
    set a system property I could get at runtime. Is there an equivalent inwls 7.0?
    I haven't found anything in the documentation for config.xml. Obviously Ican
    pass -D options to the jvm, but I was looking for a way from the configfile.
    >
    hongjie

  • Change in system property

    Hi,
    I want to know if I set a system property "-Dweblogic.ThreadPoolSize", how will the
    WLS get to know that the pool size has been changed, at run time?
    E.g. I pass -Dweblogic.ThreadPoolSize=30 from the command-line. Then if I change
    the pool size to 40 at runtime by setting system property by calling System.setProperty(String,
    String);, is there any event that I can fire for the change in property through APIs?
    Thnx in advance.
    Best Regards
    Ali

    Monitoring system properties for change can be done with JMX I think.
    But for ThreadPoolSize in WLS 6.0, I don't think there is a documented JMX
    MBean. (Maybe it exists but it's undocumented.)
    In 6.1, 7.0, there's the concept of ExecuteQueue.
    http://e-docs.bea.com/wls/docs70/javadocs/weblogic/management/configuration/
    ExecuteQueueMBean.html
    You can monitor a change by using the notification mechanism:
    http://e-docs.bea.com/wls/docs70/jmx/notifications.html
    Good luck,
    Emmanuel
    "Ali" <[email protected]> wrote in message
    news:3d0d27a4$[email protected]..
    >
    Hi,
    I want to know if I set a system property "-Dweblogic.ThreadPoolSize", howwill the
    WLS get to know that the pool size has been changed, at run time?
    E.g. I pass -Dweblogic.ThreadPoolSize=30 from the command-line. Then if Ichange
    the pool size to 40 at runtime by setting system property by callingSystem.setProperty(String,
    String);, is there any event that I can fire for the change in propertythrough APIs?
    >
    Thnx in advance.
    Best Regards
    Ali

  • WSAD System property issue

    Hi,
    I am trying to set a system property in a java program like below:
    Properties systemProperties = System.getProperties();
    systemProperties.put ("man.cacheconfig", "cacheserver-config.xml");
    System.setProperties (systemProperties);
    When I execute this program ,the WSAD console throws me error like the below:
    Caused by: (Wrapped: Failed to load configuration resource: cacheserver-config.xml) java.io.IOException: Configuration is missing: "cacheserver-config.xml", loader=sun.misc.Launcher$AppClassLoader@3cd3cce4
    Is there anyway to set the system property in WSAD ???
    Any help in this regard is appreciated
    Thanks
    Chat

    Hi Jaheer,
    I would encourage you to first look at Section 6, Software Change Management on the Solution Operations Guide available on SMP under SAP Sourcing On-Premise --> SAP Sourcing 7.0. It contains lot of very useful information.
    Basically, there are two options to transport your configurations. 1) Use Export Data functionality (aka Object Migration), 2) Import CSV or Workbook.
    The first option involves exporting configuration data from the source system as oma file and importing it into the destination system. For transporting system properties, you could either export all the system properties to a oma file by selecting the Dataset option. Or you could use the Object List option, which involves oml query. You could create a custom version of the system properties oml query and add your filter conditions in the WHERE clause. You can find more info on this in the Solution Operations Guide.
    Hope this helps.
    Regards,
    Vikram

  • How to Set "file.encoding" System Property to default "UTF-8"

    When i execute my code some special character are not being display correct so by programming approach i am trying to set "file.encoding" system property to "UTF-8", using command System.setProperty( "file.encoding", "UTF-8" ); and it is not working.
    If i run my jar using command java -Dfile.encoding=UTF-8 -jar myprog.jar . It is working and my special characters are also looking in right way.
    Can i set this defalut encoding by programming approach.
    Thanks
    Ashish Pancholi

    Hello,
    I have the same problem. I have a java prog that is started with "-Dfile.encoding=ISO-8859-1". Now in this program I want to print some characters using the UTF-8 encoding because I know that the terminal I will be printing on has this encoding. I tried using InputStramReader without success:
        InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream("Müller".getBytes()), "UTF-8");
        BufferedReader br = new BufferedReader(isr);
        String line = null;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }EDIT:
    the above example is to read something into my java program. If I want to write something from my java class to an output it goes like this:
    Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8"));
    out.write("Müller\n");
    out.flush();... in that case I get the correct encoding.
    Thanks,
    T

  • How do I set upmy Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.

    how do I set up my Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.  From systems Preferences I must select one or the other.  I want both to work all the time.

    Hi,
    I would recommend you to use 0FI_AP_4 rather using both, particularly for many reasons -
    1. DS: 0FI_AP_4  replaces DataSource 0FI_AP_3 and still uses the same extraction structure. For more details refer to the OSS note 410797.
    2. You can run the 0FI_AP_4 independent of any other FI datasources like 0FI_AR_4 and 0FI_GL_4 or even 0FI_GL_14. For more details refer to the OSS note: 551044.
    3. Map the 0FI_AP_4 to DSO: 0FIAP_O03 (or create a Z one as per your requirement).
    4. Load the same to a InfoCube (0FIAP_C03).
    Hope this helps.
    Thanks.
    Nazeer

  • Can you set a global EntityResolver (via system property, or static method)

    I'm trying to set a customized EntityResolver (telling the xml parser where to look for XML schema files).
    Usually, you'd use the standard syntax - somehting like:
    SaxParser parser=new SaxParser();
    parser.parser.setEntityResolver(myResolver);
    However, I was wondering whether you can set a "global" EntityResolver, to be used as default for all parsers ?
    Maybe this can be done through some system property, or a static method somewhere in the parsing XML ?
    (BTW, I need it because I'm using some third-party API, that encapsulates a SaxParser, but won't let me access it, so I can't configure it directly).
    thanks.

    I don't think you can.
    What is possible is to set content on the folder resource itself; that would be returned instead of the page you mentioned.

  • Is their a way to set system property in weblogic console

    Hi WL USERS
    Is their a way to set system property in weblogic console ie (http://localhost:8080/console) ? if yes, can we access that property in code using System.getProperty()?
    Regards
    vishy

    Yes, It is Possible.
    Please check the Option-1). Mention in the Following Link: http://weblogic-wonders.com/weblogic/2010/03/26/nodemanager-based-managedservers-setting-mem_args/
    Here i tried to set a Custom Property "*-Duser.dir=E:/MyDirectory*" through the Admin Console.
    NOTE: Setting any Option like JAVA_OPTIONS/CLASSPATh etc through Admin Console will work only when you start your Servers using the NodeManager. It means when you start your ManagedServers through AdminConsole...or Using nodeManager based WLST scripts.
    Thanks
    Jay SenSharma
    http://weblogic-wonders.com/weblogic/ (WebLogic Wonders Are Here)

  • Can System property set in Java Plug-in?

    Hello gurus,
    In desktop app, we could set certain system properties for example
    System.setProperty( "sun.java2d.translaccel", "true" );
    I am trying to develop simple game in applet.
    But calling this method requires the applet to signed, which is not my option.
    Is there a way i can set this property in the Java Plug-in Run-Time-Parameter field?
    Thanks in advance.

    nope, not to my knowledge.
    Until recently, you couldn't even do it at the commandline with webstart apps!
    (though you could ofcourse still use System.setProperty())

Maybe you are looking for