4 Replies Latest reply: Oct 19, 2009 6:45 PM by jschellSomeoneStoleMyAlias RSS

    JVM Custom Properties

    843798
      I am using JDK 6 and wanted to set the file.separator to use a custom value. I tried using -Dfile.separator but this does not set the value of File.separator or File.separatorChar. They still return me system specific value. But when I try System.getProperty("file.separator") I get my custom value.

      Is there a way to set jvm custom properties so the Java classes use those values.

      thnaks
        • 1. Re: JVM Custom Properties
          791266
          Strange. It looks like it should work. File.separatorChar invokes FileSystem.getSeparator() at start, and that method reads "file.separator"
          • 2. Re: JVM Custom Properties
            843798
            Out of curiosity: why do you want to set this to a custom value? That system property normally represents a OS-dependent value that is used when communicating with the OS. What good would it do to set it to a different value (that the OS probably doesn't understand).
            • 3. Re: JVM Custom Properties
              843798
              @kalbj
              yup that what I thought but its not working ... for some reason java files are not picking up the property I specify at as an arg

              @JoachimSauer
              for some reason some developers have used file.separator to build urls. For dev envs we have put all the assets on a shared file system (linux box) and use apache to point urls to those assets. Now for developers on windows box this does not work as it puts in back slashes in url. This issue as come up as we recently migrated to weblogic 10.3 and jdk 1.6. I was looking for a quick fix to this.
              • 4. Re: JVM Custom Properties
                jschellSomeoneStoleMyAlias
                sandy_oberoi1 wrote:
                for some reason some developers have used file.separator to build urls.
                Because they didn't know what they were doing. Hopefully you sent an email to the group explaining the difference between files and urls.
                I was looking for a quick fix to this.
                Myself I would be rather concerned what else the "quick fix" might break.