Persisting Java Properties

I am currently using OpenLDAP with a Tomcat JNDI Realm to do authentication and to store Java User objects mapped to an InetOrgPerson objectClass and have been doing so for some time in production.
What I would like to do and have been searching for, is to take the Plethora of *.properties files I have in multiple webapps and extend my properties loader to look in OpenLDAP and build the Properties object from values stored in LDAP instead of from the filesystem. The obvious advantage is that for some properties files, each webapp has the same properties file, like the connect info to the content server. If I change the connect info to the content server I want to change it in ONE place, i.e. LDAP, not each and every separate properties file.
In my search I see examples of using serialization to bind a java object to an entry
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,"cn=Directory Manager"); // specify the username
env.put(Context.SECURITY_CREDENTIALS,"password"); // specify the password
DirContext ctx = new InitialDirContext(env);
Properties properties = new Properties();

ctx.bind("cn=coolProps,ou=JavaObjects,o=myserver.com ", properties);
This throws an InvalidAttributeIdentifierException on javaSerializedData on OpenLDAP 2.2.29-db-4.3.29 win32 distribution, running on XP Pro.
Even this will be ok as far as it goes but the problem with this is that I would rather have an objectClass schema entry that gave me LDAP modification of the individual properties, so I can use JXplorer (or any LDAP Browser) to manage the properties, just the same as I can modify the properties in the more concrete classes I have mapped. But I do NOT want to create a new schema for every properties file and map each one individually.
Does someone have a Java Properties objectClass schema and java helper example they can/will share? Or is it something I just didn�t manage to find because I didn�t search for the right words?
NOTE* The OpenLDAP Software forum's moderator said this was "off topic" and the latest Open LDAP does NOT include the JavaObject schema.
Ollie

This throws an InvalidAttributeIdentifierException on
javaSerializedData on OpenLDAP 2.2.29-db-4.3.29 win32
distribution, running on XP Pro. My bad, I realized I didn't have the java.schema configured.
>
Does someone have a Java Properties objectClass
schema and java helper example they can/will share?
Or is it something I just didn�t manage to find
d because I didn�t search for the right words?
However I still would like to get a JavaProperties schema if someone has one and some Java helpers to work with it.

Similar Messages

  • How to set proxy authentication using java properties at run time

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

  • Static lookup lists:read data from a Java *.properties file

    Hi
    i need to make static lookup lists i am using read data from a Java *.properties file
    i am using the Class "PropertyFileBasedLookupViewObjectImpl" that wrote by Steve Muench in ToyStore.
    but i need to use the default language for that i update the loadDataFromPropertiesFile()
    method to find the correct properties file
    String temp=Locale.getDefault().getLanguage();
    String propertyFile =
    getViewDef().getFullName().replace('.', '/')+"_"+temp+ ".properties";
    the problem:
    For English(TEST_en.properties) it is good and working
    For Arabic(TEST_ar.properties) read from correct file _ar.properties
    but the dispaly character is wrong
    When Debug
    In the File 1=&#1583;&#1605;&#1588;&#1602;
    In debug 1=/u32423

    Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html

  • How to configure Java Properties File location in WLW

    How do we tell Workshop 7.0 where to look for Java properties files (loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

    Ray,
    The build number indicates that you have not upgraded to Service Pack 2 of
    version 7.0. I will strongly recommend you to do so. That will shield you
    from the issues which were fixed in the 2 service packs.
    Regards,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    >
    Raj,
    We are using WebLogic Workshop Build 7.0.1.0.0829.0 on Windows 2000.
    We shut down the WebLogic Server on Solaris 2.6, log off, log back on,startWebLogic
    in production nodebug mode, and re-run jwsCompile on the same source code.The
    error does not occur anymore. Everything seems to be fine now.
    Thanks,
    Ray
    "Raj Alagumalai" <[email protected]> wrote:
    Hello Ray,
    Can you let me know if you are using the GA version of WebLogic Workshop
    or
    if you have the latest Service Pack.
    Thank You,
    Raj Alagumalai
    WebLogic Workshop Support
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    Anurag:
    Thanks for your response!
    By moving the property files to WEB-INF/classes from WEB-INF, we arealmost there.
    But we have a follow up problem. We use a static initializer to loadthe
    log4j
    property file like this:
    static {
    try {
    ClassLoader cl= (new Log()).getClass().getClassLoader();
    InputStream is = cl.getResourceAsStream(logfile);
    Properties props = new Properties();
    props.load(is);
    PropertyConfigurator.configure(props);
    } catch (Exception e) {
    e.printStackTrace();
    When we run jwsCompile, we keep getting this:
    Compiling: com/****/TestWS.jws
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[weblogic.management.Admin
    may only be used on the Server ]
    at weblogic.management.Admin.getInstance(Admin.java:104)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.getSecret(ServerPrin
    cipalValidatorImpl.java:79)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.sign(ServerPrincipal
    ValidatorImpl.java:59)
    at
    weblogic.security.service.PrivilegedActions$SignPrincipalAction.run(Privileg
    edActions.java:70)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    weblogic.security.service.SecurityServiceManager.createServerID(SecurityServ
    iceManager.java:1826)
    at
    weblogic.security.service.SecurityServiceManager.getServerID(SecurityService
    Manager.java:1839)
    at
    weblogic.security.service.SecurityServiceManager.sendASToWire(SecurityServic
    eManager.java:538)
    at
    weblogic.security.service.SecurityServiceManager.getCurrentSubjectForWire(Se
    curityServiceManager.java:1737)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:434)
    at
    weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:
    88)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :255)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :230)
    at
    weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown
    Source)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
    at javax.naming.InitialContext.lookup(InitialContext.java:345)
    at weblogic.knex.bean.EJBGenerator$1.run(EJBGenerator.java:101)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    atweblogic.knex.bean.EJBGenerator.lookupAdminHome(EJBGenerator.java:84)
    atweblogic.knex.bean.EJBGenerator.ensureAdminHome(EJBGenerator.java:122)
    at weblogic.knex.bean.EJBGenerator$6.run(EJBGenerator.java:660)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    atweblogic.knex.bean.EJBGenerator.generateJar(EJBGenerator.java:482)
    at
    weblogic.knex.dispatcher.DispJar.generateJar(DispJar.java:401)
    atweblogic.knex.dispatcher.DispCache.ensureDispUnit(DispCache.java:695)
    atweblogic.knex.compiler.JwsCompile.compileJws(JwsCompile.java:872)
    at
    weblogic.knex.compiler.JwsCompile.compile(JwsCompile.java:619)
    at weblogic.knex.compiler.JwsCompile.main(JwsCompile.java:109)
    ejbc successful.
    Generating EAR ...
    The EAR was generated and we can even deploy it on Solaris. But whatdoes
    the
    AssertionError mean?
    Thanks,
    Ray
    "Anurag Pareek" <[email protected]> wrote:
    Ray,
    ResourceBundle looks for the properties file in the current thread's
    classpath.
    Since a Workshop webservice's project is nothing but a webapp, the
    properties files can be kept in the WEB-INF/classes directory, which
    is part
    of the webapp classpath.
    You can also use
    Thread.currentThread().getContextClassLoader().getResourceAsStream("MyProp
    s
    properties"); to get access to the properties file.
    Thanks,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    How do we tell Workshop 7.0 where to look for Java properties files(loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

  • How to load Java properties file dynamically using weblogic server

    Hi,
    We are using Java properties file in Java code. Properties in java properties file are frequently modified. If I keep these properties file in project classpath or as part of war, I will have to redeploy application after each change.
    We are using Weblogic Server.
    Can you please suggest me how can this properties file be loaded at weblogic server startup. Then in that case, how to refer property file in Java code?
    What is the best practice for this?
    Thanks,
    Parshant

    Another alternative is, keep the property file in any pre-defined location. Write a class which reads the properties from the file and returns the one which is requested by caller and deploy this class. Whenever you have to change the properties just update the property file on server and next call to fetch the property should return the updated one.
    Downside of this approach is file I/O everytime. To overcome that you can actually "cache" the properties in a hashmap. Basically when any property if requested, first check the hashmap, if not found then only read from property file and also update in hash map. Next time same property will be returned from hash map itself. The hash map will be cleared at every server restart since its in the memory. You will also need to build a method to clear the hashmap when you update the values in the property file on server.
    This solution would be suitable for small size files and when network overhead of calling a DB needs to be avoided.

  • Bad http.agent in Java properties : a bug in the HTTP user-agent string?

    Hi all,
    Me :
    I'm patching AWSTATS (web log analyzer tool) in order to recognize which Java version has
    been used to download files.
    Context of the problem :
    Each time a Java program (or applet) is downloading a file (for example .class, .png, .html)
    from a web server, a line will be added in the web server log file. If the web server is well
    configured, the user agent used to download the file will be at the end of the line in the log file.
    For Sun Java JVM, the user agent string is configured in the Java properties under "http.agent".
    Usually, the user-agent string contains the word "Java" and the virtual machine version. In most
    cases, this is just a string like "Java/1.4.2", so this is relatively easy to parse.
    Problem :
    Looking in my web server stats, and then on the web, I found that a JVM's user-agent is
    "Mozilla/4.0 (Windows XP 5.1)", which obviously does not contains the word "Java".
    Consequently, it is difficult to say that this user-agent string belongs to a JVM.
    Further look in my log files and on google shows that this http.agent string appears
    on Microsoft Internet Explorer (it seems MSIE 6.0) over Windows XP with the J2RE plugin:
    http://board.gulli.com/thread/300321
    http://forum.java.sun.com/thread.jsp?thread=531295&forum=30&message=2559523
    http://forum.java.sun.com/thread.jsp?forum=63&thread=132769&start=210&range=15&tstart=0&trange=15
    http://forum.java.sun.com/thread.jsp?forum=32&thread=480899
    http://www.goodidea.ru/setupJava/javaInstall.htm
    The J2RE plugin version does not seems to play a role as this user-agent string has
    been seen on 1.4.1_02-b06, 1.4.2_01, 1.4.2_03 and 1.4.2_04-b05.
    Further information requested :
    I would like to know:
    1) if you have reported the same problem;
    2) if there is some rules for the http.agent property;
    3) if this is a bug.
    Thank you very much, and feel free to add you opinion.
    Julien

    The web log files where the "Mozilla/4.0 (Windows XP 5.1)" user-agent appears can be displayed using the following search terms on google :
    "Mozilla/4.0 (Windows XP 5.1)" -"(Windows XP 5.1) Java"
    http://www.google.ch/search?hl=fr&ie=UTF-8&q=%22Mozilla%2F4.0+%28Windows+XP+5.1%29%22+-%22%28Windows+XP+5.1%29+Java%22&btnG=Rechercher&meta=
    Julien

  • Java Properties closing unexpectedly

    Have you ever had a problem with java closing the after opening it through the control panel unexpectedly?
    I open the Java Properties in the Control Panel, I goto the Update tab then I uncheck the box for “Check for Updates Automatically”
    Then like usual this prompt opens. When I click never check the properties closes out without the chance for me to click ok, and it’s still running in the task manager and the only way for me to open it back up is to end the process.

    This works for me (size = 100,000 entries).
    import java.io.*;
    import java.util.*;
    public class PropertyTest {
        private final static int SIZE = 100000;
        private final static File FILE = new File("test.properties");
        public static void main(String[] args) throws IOException {
            PropertyTest app = new PropertyTest();
            app.store();
            app.load();
        void store() throws IOException {
            FileWriter out = new FileWriter(FILE);
            try {
                Properties props = new Properties();
                for(int i=0; i<SIZE; ++i) {
                    String keyAndValue = String.valueOf(i);
                    props.setProperty(keyAndValue, keyAndValue);
                props.store(out, "here we go");
            } finally {
                out.close();
        void load() throws IOException {
            Properties props = new Properties();
            BufferedReader in = new BufferedReader(new FileReader(FILE));
            try {
                props.load(in);
            } finally {
                in.close();
            if (props.size() != SIZE) {
                throw new RuntimeException ("wrong size, size=" + props.size());
            for(int i=0; i<SIZE; ++i) {
                String key = String.valueOf(i);
                String value = props.getProperty(key);
                if (!key.equals(value)) {
                    throw new RuntimeException ("wrong value, expected=" + key + " found=" + value);
            System.out.println("load success");
    }

  • Setting Java Properties

    Hi everybody. I have been looking around, but can't find anywhere where you set Java Properties (the one's you get via System.getProperty() ) in the iAS. Our current application has a lot of these properties, and in order for getting it running on the iAS I must be able to specify Java Properties. Does anybody know where I do this (it's an OC4J mod, not JServ).
    Regards, Magnus Edevag
    [email protected]

    It's easy - in each OC4J container there is a "server" link (down at the left side). In following screen there are three lines (again at the bottom) - last one is called Java properties. It is where you specify startup parameters for JVM. BTW, you can find them in opmn/conf/opmn.xml. Sometimes, if you hit the wrong button you have to go there and edit directly.
    Myrra

  • Access java properties from C++/JNI program

    Hello all,
    Is it possible to access the Java properties of a JNI VM from a C++ program?
    If so, could the code or process be explained to me.
    I want to be able to identify a specific VM that is retrieved by the JNI_GetCreatedJavaVMs
    call. I set a user property when the VM was created, and would like to verify its value
    before calling AttachCurrentThread.
    Thanks in advance.
    Mark

    Are you saying that you set a system property (via System.setProperty() or -D)?
    If so, just use the JNI invocation API to call System.getProperty().
    Without error checking, that looks something like this:bool isMySystem( JNIEnv* env ) {
      const string PropertyName = "IsMySystem";
      jclass systemClass = env->FindClass( "java/lang/System" );
      jmethodID getPropertyMethod = env->GetStaticMethodID( systemClass, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;" );
      jstring propertyNameString = env->NewStringUTF( PropertyName.c_str() );
      jstring propertyString = env->CallStaticObjectMethod( systemClass, getPropertyMethod, propertyNameString );
      if ( propertyString == 0 ) {
        return false;
      const char* property = env->GetStringUTFChars( propertyString, 0 );
      boolean isMine = ! strcmp( property, "Yes" );
      env->ReleaseStringUTFChars( propertyString, property );
      return isMine;
    }Using Jace, http://jace.reyelts.com/jace (a free, open-source toolkit), this would look more like:bool isMySystem() {
      String property = System::getProperty( "IsMySystem" );
      return property.isNull() ? false : prop == "Yes";
    }In the end, Jace ends up making all of the exact same calls, but you can see how much easier it is to use.
    God bless,
    -Toby Reyelts

  • Avoid HTML Escapes in Java properties

    In using Java properties, I have the following string in the Java property file:
    prop1=Click the <a href=#>Help</a> link.
    which unfortunately becomes:
    Click the & lt ;a href=#>Help & lt ;/a> link.
    when the property is printed out (sorry, I put in spaces to have & and ; render correctly).
    How should I AVOID having HTML Escape chars put into the property list

    Come again? besides your question being hardly readable thanks to that formatting, I don't understand it. What do properties have to do with HTML? Properties aren't HTML and Java doesn't convert them.
    I don't know what "printing them out" means either. How do you print them where?

  • Need help for how to putting arabic content in java properties file

    Hi all,
    we have to support arabic in Java application.
    For that we are using java propeties file where key and value pair is used.
    In the Microsoft excel sheet arabic content is coming properly from right to left direction.
    When same thing is copied and paste in java properties file contents direction is reversed that is it is coming from left to right as in english.
    Please help how to put the arabic contents in propeties file
    Regards
    Vidya

    So in terms discussion.
    First I would suggest that you get a hex editor and validate exactly what is in the properties file. It appears to me that you are using one or more editors that are adjusting the display for you and thus that makes it hard to determine where the problem is. A hex editor should not adjust the display. Although even then you might want to right a simple java app and have it read bytes and print them just to validate that the hex editor isn't doing something.
    Only after you are exactly sure how the bytes appear in the file then proceed with other steps.
    For the java GUI only test the following.
    1. Properties file has it left to right then the java GUI displays it correctly right to left or not?
    2. Properties file has it right to left then the java GUI displays it correctly right to left or not?
    Myself I would expect that 2 should be the correct way to implement this. However that is dependent upon you correctly invoking the api as well. So if 2 is not working then you might want to look at the api. It might also have something to do with GUI display properties (of which I know even less.)

  • Java properties file

    Hi ,
    I am using trying to write data to a java properties file , by using the setProperty method and somehow the order of the data is not by the order of inserting it ,Is there a way to use the setProperty method and still keep the order of data in the file after storing it.
    Thanks.

    Eddie404 wrote:
    I am using trying to write data to a java properties file , by using the setProperty method and somehow the order of the data is not by the order of inserting it ,Is there a way to use the setProperty method and still keep the order of data in the file after storing it.It shouldn't matter what order the Properties class uses to write its data. If it does, you aren't doing something right.
    If the order matters, that suggests that somebody is responsible for maintaining the properties via a text editor, or something like that. In which case you shouldn't be using a Properties object which modifies the property file. But as soon as you start having two different processes to maintain the file, you're going to run into trouble. So simplify your life and stop doing that. Either maintain it through the program, or through the text editor, but not both ways.

  • Custom component  - how to store java Properties object in ucm environment

    Hi Experts,
    I am developing a custom component.
    my custom component code is reading a properties file and load in Properties object. Everytime this custom Service is called, properties file is read from file system and new Properties Object is created.
    Is there any way to load the Properties object once and store somewhere in UCM context ? (just like we do in JSP using application object"
    thanks!!
    Edited by: user4884609 on Jul 12, 2010 3:01 PM

    I'd say there are quite a few ways how to do it, but many of them have nothing in common with UCM.
    - I'd opt for the only "UCM" way I' aware of: as a part of custom component you can create your own properties file (it's also called environment variables) as a part of your custom component. You can, then, easily read (and write?) properties from/to the file.
    - The first option could have disadvantage, if there are too many properties. In this case you could use Java serialization - it should be UCM independent
    - Another option is to create your properties in the database - it is a bit similar to the first option, but it's more robust. Plus, you may use features of the database if you want to have some additional logic in you properties.
    - Note that you can also create a static object, which could be initialized e.g during class load

  • Default Java properties

    Does anyone know how to set a default property, without specifying it on the command line. ie if you use the command line the command is:
    java -Dthis.property=somevalue MyProg.class
    I want to be able to do that without specifying it on the command line. ie this command:
    java MyProg.class
    automatically picks up some default properties.
    I know you can do this with swing properties by defining a file called swing.properties in the lib directory of the jre. Can this be done with normal system properties?

    Thanks for your reply.
    I am looking for a more general purpose use. As in I
    am using a program that I did not write. In Windows
    NT I can choose to set up a service to start this app
    or use a script file that includes a call to "java
    .... file.class" to start the application. In the
    command script I have it set up to set a certain
    property that the application needs. In order to run
    this script, someone has to log on and run it manually
    or have it in their start up folder. If I allow the
    app to start up as a service, no one has to log on,
    the machine just needs to be powered up for the app to
    run. The problem is, the property I need set is not
    there.
    So to sum it up ALL of the following are true.
    1. You need a command line property.
    2. You are using a script to run the jvm (and java application.)
    3. That script is set up to run as a service.
    4. Lastly it "just doesn't work."
    Given the above it means that this has nothing to do with java.
    You are probably running the service with the 'default' user. That generally isn't a good idea, mainly because it is rather hard to tell exactly what that user can access, and in particular because it means things that normally are set up are not set up.
    So the first step is to set up a user to run that service. Then change the service so it starts up with that user.
    The second step is to log on as that user (the user should not be a normal user.) And then run the application using the script. Modify the environment and the script until the application works as you want.
    Finally, log off, restart the box and see if the service starts. If it doesn't then the most likely reason is because you made an assumption about the environment of the user that just wasn't true. The most common problem is where the service starts up (the 'current working directory'.) That can be most easily fixed by hard coding all paths or determining where the real current working directory is for that service (probably 'windows/system') and modifying the environment again so it works there.

  • Persistent Java processes

    The following questions refers to development on the Sun Solaris environment using SDK1.4.2:
    Hi, I need to write a Java application that is persistent such that when a user logs out, the process doesn't go away. This seems pretty straight forward as I should be able to put the process in the background and have it run forever. However, when my public class contains a JFrame, the process doesn't seem to stick around after I log out. I've tried to execute the dispose() method on my JFrame, but that didn't work. Can someone please let me know if there's a way to write a Java application that contains a JFrame object that can be persistent? Again, by persistent, I mean that I need my process to stay around after the user logs out.
    Thanks.

    The thing is, this application really isn't a GUI application. It has a few references to GUI classes, but ultimately, it's just a process that runs in the background. Like I said, the GUI's go away after the user initially sets their configuration information and then the process just simply runs in the background. One solution that will work is if I have the GUI's that I reference to run in their own processes. I don't want to have to do this because it takes a long time for these GUI's to come up because they are being started from scratch. If they are part of my main class, they come up immediately when I do a show().
    What I think is happening is that the Threads that run as part of the JFrame object are receiving a signal when I log out and it's passing the signal to my main process to shutdown. So my question really is: How can I kill all the threads related to a JFrame? After I get what I need from it, I'd like to clean it up manually. Especially since the finalize() method doesn't work for swing objects.

Maybe you are looking for

  • GarageBand 3 is missing 3 loops from earlier versions

    I did a clean install of Garageband 3 (hid my old GBand 1&2 loops folder), and then compared the two folders. There are three loops missing from GBand3 that are present in my older loop folder: Club Dance Beat 052.aif Plucky Guitar Loop 01.aif Plucky

  • IPad sending videos always as if external screen were 4:3

    iPad admits videos that are decent to be watched on HDTV sets. iPhone requires videos to be smaller (iOS 4.xx). However, iPad INSISTS on considering-using the Apple Component cable-that the output is going to a 4:3 set, and not a 16:9 or Widescreen,

  • REPORT - Sold quantity and OnHand quantity

    Hello Everyone, How can I create a query to show what I have sold within a date range and how much inventory I have of those items.  Thank you. itemcode      sold        onhand     whscod x                    10                5            AH x      

  • How to set date format dd.MM.yy for chart time axis

    Is it possible to set default date format dd.MM.yy instead of MM/dd/yy in Flex charts without using label function ? In this case we do not know beforehand the length of the time span; it can be minutes, days or weeks. Setting locales in compiler opt

  • Manually set height of selected objects / smart objects

    This might be a dumb question, considering how many years I've been using Photoshop, but .... I was lining up and resizing these smart objects, each on its own layer. Typically I simply layout a guide and drag it but I was wondering if there is a way