Set system property using -D flag that references another system property

Hi,
I'm interested in doing something like the following
java -Dmy.prop=${user.home}/.tmpdir
Setting the property in Java code is not an option.
Can this be done?
Thanks for helping.

The only way I think you could do this is to ask the os for this value.
i.e windows: $HOMEDRIVE\$HOMEPATH
java -Dmy.prop=$HOMEDRIVE\$HOMEPATH\.tmpdir
linux: ~
java -Dmy.prop=~/.tmpdir
Or to use a small java application to return the value into the command line:
java -Dmy.prop=$(java HomeDir)/.tmpdir
class HomeDir {
  public void main (String ... args) {
    System.out.println(System.getProperty("home.dir"));
}

Similar Messages

  • Compiling error with a class that references another class

    Hello,
    I have two Java-Classes in two files in the same folder. Both are in the same package. The class StatusZwo should reference the function ValueX of the class Status.
    The class Status has a function which returns the boolean value true. If compile the file Status.java there is no error, but if I
    compile the file StatusZwo.java there comes the error message:
    D:\Test\Test>javac StatusZwo.java
    StatusZwo.java:12: cannot resolve symbol
    symbol : variable Status
    location: class Test.StatusZwo
    System.out.printLn(Status.ValueX);
    StatusZwo.java
    package Test;
    import Test.*;
    public class StatusZwo{
    public static void main (String arguments[]) {
    System.out.printLn(Status.ValueX);
    Status.java:
    package Test;
    public class Status{
    public static boolean ValueX() {
    return true;
    What is the problem?
    Thank you Flo

    Next time please use [code] and [/code] tags around any code.
    There are two issues on one particular line;
    [code]System.out.printLn(Status.ValueX);[/code]
    should be
    [code]System.out.println(Status.ValueX());[/code]

  • How to dynamically configure JPA setting at runtime using java code?

    Hi,
    I am new to EJB 3.0 and JPA. I am trying to help my company to deploy the use of JPA in EJB3.0. Currently, i am trying out with OpenJPA in IBM Webshpere Application Server 7.0. We have four different WAS servers running for testing, system integration testing, user testing and production respectively, and in each region, the configurations for data source, JDBC username and password, schema, etc are different. So i think i would need to configure the JPA setting during runtime using Java code that determines which is the environment. And apparently i am stuck with the limited knowledge i have.
    1) I understand that i could override the JDBC in the persistence xml by creating entity manager using entity manager factory. But is it possible that i do similar thing by using inejction of persistence context on entity manager to obtain a container managed entity manager?
    2) Alternatively, it is possible to create multiple persistence unit in the XML and inject different PU to the entity manager, am i right? But how to inject dynamically since @PersistenceContext(unitName="xxx") only accepts constant declaration.
    3) Is it possible that the JDBC username and password are read from properties file?
    Thanks for your help in advance!

    Hi
    Thanks for the reply.
    Are you saying that i have to configure the data source authentication to the backend DB2 using the JAAS-J2C? Correct me if i am mistaken. I guess i am unable to do so as the application server setup only contains one data source, and the server hosted a number of applications. Every applications has their own JDBC username and password supply to the data source (the ID supplied at the DB2 side will decide which resource can access) and thus, i have to supply the username and password at runtime. Talked to the server guy and seems that it is not feasible to have seperate datasource for each applications as considered to the volume of applications hosted inside the server.
    Any suggestion?

  • [svn:fx-trunk] 12057: Label (and RichText) will show text as tooltip if truncated and new showTruncationTip flag is set to true  ( defaults to false because Label is often used in skin that have their own tooltip logic ).

    Revision: 12057
    Revision: 12057
    Author:   [email protected]
    Date:     2009-11-20 11:22:05 -0800 (Fri, 20 Nov 2009)
    Log Message:
    Label (and RichText) will show text as tooltip if truncated and new showTruncationTip flag is set to true (defaults to false because Label is often used in skin that have their own tooltip logic).
    QE Notes: New API (showTruncationTip)
    Doc Notes: New API (showTruncationTip)
    Bugs: SDK-23639
    Reviewer: Gordon
    API Change: Yes
    Is noteworthy for integration: Yes
    tests: checkintests mustella/gumbo/components/Button mustella/gumbo/components/Label
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23639
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as

    Hi blabla12345,
    (untested and without warranty)
    replace this line:
    const sSaveCUBE = "CUBE";
    with this:
    const sSaveCUBE = "cube";
    Have fun

  • 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)

  • [solved] Using xprop to set a property

    xprop(1) has a "-set" option. I can't figure out how to use it. The "surf" browser is scriptable by setting a property named "_SURF_URL" to the URL you want it to load. I've tried these:
    $ xprop -id 14680096 -set _SURF_URL http://www.google.com
    xprop: error: unsupported conversion for _SURF_URL
    $ xprop -id 14680096 -f _SURF_URL STRING -set _SURF_URL http://www.google.com
    xprop: error: Bad format: STRING.
    (The "id" is the one printed by "surf -x", and is correct, since I can use it to read properties.)
    How do I use this?
    Last edited by ataraxia (2009-08-12 14:55:01)

    The -f option isn't that straightforward... see the description of 'format' and 'dformat' in xprop(1).
    This should work:
    xprop -id 14680096 -f _SURF_URL 8s -set _SURF_URL http://www.google.com

  • How I can set Leopard to use the color management mixture that Tiger uses?

    I have recently bought a new Mac with Leopard installed. My old Mac is running Tiger. Unfortunately the color management default settings in Leopard are different than in Tiger, so this is completely messing up my calibration. Can somebody please tell me how I can set Leopard to use whatever color management mixture that Tiger uses? - Thanks.

    I already have set FF to No Proxy. This made FF work again, but not any of my other internet programs, programs that don't have the option to set to no proxy, they rely on the system settings. So I need to know how to reset my system settings back to their default values. This will allow all my net progs to access the net again, including FF using the Use System Settings option. Since FF has an option to use system settings, this is a somewhat FF related question. I need to get all my net programs working again, not just FF! And, if my system settings are restored, FF will work using the system settings, and all my other progs will work too.

  • Hot to set system property?

    When running my application I do it by calling
    <java -Dorg.omg.CORBA.ORBInitialHost=192.175.5.1 com.gui.Login>
    but I read somewhere I could only type
    <java com.gui.Login>
    if I set system property <org.omg.CORBA.ORBInitialHost=192.175.5.1> in java code. Does anyone know how can I do it?
    Thanks.

    Thank you so much Bjarne
    It really worked and finally we aren't with that headache of few weeks ago.
    Thanks... really.
    kind regards, Celso

  • Can separate apple ids be set up for individual family members that use different devices?  Several iPads are tied to one Apple ID (email address). Thank you.

    Can separate apple ids be set up for individual family members that use different devices (iPads & iPhones)?  Several family members are tied to one apple id (email address).  Thanks.

    How to use multiple iPods, iPads, or iPhones with one computer
    http://support.apple.com/kb/HT1495
    How to Share a Family iPad
    http://www.macworld.com/article/1163347/how_to_share_a_family_ipad.html
    Using iPhone, iPad, or iPod with multiple computers
    http://support.apple.com/kb/ht1202
    iOS & iCloud Tips: Sharing an Apple ID With Your Family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/
    How To Best Use and Share Apple IDs across iPhones, iPads and iPods
    http://www.nerdsonsite.com/blog/2012/06/07/help-im-appleid-confused/
     Cheers, Tom

  • HT204053 I want to use the same apple id for iTunes and iCloud...but I have both set up..my problem is I want to use the one that I use for iTunes for both

    I want to use the same apple id for iTunes and iCloud...but I have both set up..my problem is I want to use the one that I use for iTunes for both

    iForgot.com

  • Using xmlns in schemas that reference Oracle registered schema

    I have two schemas: a.xsd and b.xsd. b.xsd uses an xmlns to reference a.xsd. But when I call dbms_xmlschema.registerSchema, the a.xsd schema works ok, but the b.xsd schema fails with the following error:
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00023: unknown namespace URI "http://xmlns/a"
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 2
    I've tried with and without an xsi:schemaLocation in b.xsd and both fail with the same error.
    Has anyone had any luck using this multiple schema reference functionality? I'm on the latest Oracle 9i (9.2.0.3.0) 64-bit on Solaris 2.8.
    Thanks,
    -Darren
    Here's the output of my sqlplus session:
    SQL*Plus: Release 8.1.6.0.0 - Production on Wed May 14 13:43:56 2003
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    SQL> set long 10000
    SQL> SELECT user FROM dual
    2 /
    USER
    XDB
    SQL> SELECT getDocument('xsd/a.xsd') FROM dual
    2 /
    GETDOCUMENT('XSD/A.XSD')
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://xmlns/a" xmlns="http://xmlns/a" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="a">
    <xs:simpleType>
    <xs:restriction base="xs:string">
         <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:schema>
    GETDOCUMENT('XSD/A.XSD')
    SQL> BEGIN
    2 dbms_xmlschema.registerSchema(
    3      schemaURL => 'http://xmlns/a',
    4      schemaDoc => getDocument('xsd/a.xsd'),
    5      local => false);
    6 END;
    7 /
    PL/SQL procedure successfully completed.
    SQL> COMMIT
    2 /
    Commit complete.
    SQL> SELECT owner, schema_url FROM all_xml_schemas WHERE schema_url = 'http://xmlns/a'
    2 /
    OWNER
    SCHEMA_URL
    XDB
    http://xmlns/a
    SQL> SELECT getDocument('xsd/b.xsd') FROM dual
    2 /
    GETDOCUMENT('XSD/B.XSD')
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://xmlns/b" xmlns="http://xmlns/b" xmlns:a="http://xmlns/a" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="b">
    <xs:complexType>
    <xs:sequence>
         <xs:element name="c">
         <xs:simpleType>
         <xs:restriction base="xs:string">
         <xs:maxLength value="200"/>
         </xs:restriction>
         </xs:simpleType>
         </xs:element>
         <xs:element ref="a:a"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    SQL> BEGIN
    2 dbms_xmlschema.registerSchema(
    3      schemaURL => 'http://xmlns/b',
    4      schemaDoc => getDocument('xsd/b.xsd'),
    5      local => false);
    6 END;
    7 /
    BEGIN
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00023: unknown namespace URI "http://xmlns/a"
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 2
    SQL> SELECT getDocument('xsd/b-with-location.xsd') FROM dual
    2 /
    GETDOCUMENT('XSD/B-WITH-LOCATION.XSD')
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema
         targetNamespace="http://xmlns/b"
         xmlns="http://xmlns/b"
         xmlns:a="http://xmlns/a"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns/a http://xmlns/a">
    <xs:element name="b">
    <xs:complexType>
    <xs:sequence>
         <xs:element name="c">
         <xs:simpleType>
         <xs:restriction base="xs:string">
         <xs:maxLength value="200"/>
         </xs:restriction>
         </xs:simpleType>
         </xs:element>
         <xs:element ref="a:a"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    SQL> BEGIN
    2 dbms_xmlschema.registerSchema(
    3      schemaURL => 'http://xmlns/b',
    4      schemaDoc => getDocument('xsd/b-with-location.xsd'),
    5      local => false);
    6 END;
    7 /
    BEGIN
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00023: unknown namespace URI "http://xmlns/a"
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 2
    SQL> COMMIT
    2 /
    Commit complete.
    SQL> SELECT owner, schema_url FROM all_xml_schemas
    2 WHERE schema_url = 'http://xmlns/a' OR schema_url = 'http://xmlns/b'
    3 /
    OWNER
    SCHEMA_URL
    XDB
    http://xmlns/a
    SQL> QUIT
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production

    This is resolved.

  • I am using PS cs6 and lightroom and I am having a hard time know what color space to choose.  The lab that I am using told me that their color space is sRGB.  Do I need to have both PS and Lightroom set at sRGB or should I have PS set at adobe RGB and jus

    I am using PS cs6 and lightroom and I am having a hard time know what color space to choose.  The lab that I am using told me that their color space is sRGB.  Do I need to have both PS and Lightroom set at sRGB or should I have PS set at adobe RGB and just set my export from lightroom as sRGB?

    Please post in the Photoshop forum.
    http://forums.adobe.com/community/photoshop
    Bob

  • Set trigger property using JDAPI

    Hi.
    I have a couple of forms I need to modify using JDAPI. Among others I need to set trigger property "Fire in enter query mode" from no to yes. But I just cant find the way how to do this.
    Any help would be appreciated.
    Gregor

    This help may have some info..
    http://www.oracle.com/webapps/online-help/forms/10g/
    Please expand the "Programming Oracle Forms with JDAPI" item and look inside.
    http://www.oracle.com/webapps/online-help/forms/10g/state/content/navId.3/navSetId._/vtTopicFile.jdapi%7Cjdapi_subclassobjprops~html/vtTopicId./

  • Does anyone know how to set up a macbook pro so that other computers can join me and use my internet connection?

    Does anyone know how to set up a macbook pro so that other computers can join me and use my internet connection?

    Have you set up any security on the Mac Connection Sharing?
    Sorry but I don't use that so I'm not familiar with the settings.
    But if you haven't setup and security the iPhone might not mind but I know most Windows computers do not like to connect to Open WiFi. and make sure it is WPA or WPA2.
    Then again it may be a setting in the connection sharing like some type of MAC filtering or it may simply be that Mac OS X connection sharing only allows one connection at a time. Try disconnecting your phone and then connect the PC.
    As to Linc's response about Windows.
    Windows basically does care about connecting to open, unsecured, WiFi. But it will normally pop up a windows asking "Are myou sure you want to connect to this open network". And a simple click on yes will get you connected and an IP address.
    So this is clearly a Mac OS X problem.

  • How to Set "DateOnly" property in DateTimeControl using Javascript.

    How to Set "DateOnly" property in DateTimeControl using JavaScript.

    Is there any specific reason you want to set it through JavaScript ? You can directly set the DateOnly property in the markup itself.
    <SharePoint:DateTimeControl runat=server id="dtControl" DateOnly="true"></SharePoint:DateTimeControl>
    Please can you elaborate on what exactly is the requirement for setting this through javascript?
    Geetanjali Arora | My blogs |

Maybe you are looking for

  • Getting an error in deploying the SalesQuoteDemo application. Pls help.

    As part of my project work, I have to understand BPM/SOA Suite. As part of this, I installed SalesQuoteDemo and all related softwares in my laptop. I have also configured the Weblogic/SalesQuotesDemo as given in the attached PDF documents. Finally, W

  • My iphone 5 has no sound

    My iphone no longer has any sound at all through the speakers or the headphone.  I can't hear ring tones, any tones, music, videos, use of the speaker phone during phone calls, nothing. This phone is only 2 months old and I just did a software upgrad

  • Internal Server Error; Live View not working...please help:)

    I am a beginner doing a tutorial through David Sawyer McFarlands' "CS5: The Missisng Manual.  I have MAMP set up and working fine.  I just got through doing a tutorial on editing a recordset and linking to a Detail page.  I have used Live View just a

  • FCPx with earlier FCP projects

    I cannot understand how apple can call this "FINAL CUT"....  It will not open Final cut projects. I guarantee that Adobe will NEVER make a version of Photoshop that cannot open a .psd file.  Even Microsoft will never make a version of Excel that cann

  • Cronjob not to execute when root password expires

    I noticed that when Solaris 10 root password expires, the cron job under root won't run. Anyone have any suggestion for allow expired root password to run cronjobs?