1 2 Previous Next 21 Replies Latest reply on Oct 5, 2011 6:14 AM by tschodt

    How to configure JRE?

    ptoye
      In a previous thread I was told that my Java 7 was wrongly configured. But I can find absolutely nothing in the documentation about configuring it.

      What I want to do is to make sure that when I invoke it the java.net.preferIPv4Stack=true parameter is set without having to type (or, more usually, mistype) it each time.
        • 1. Re: How to configure JRE?
          tschodt
          You can use environment variables - the JVM reads these environment variables
          JAVAOPTIONS

          JAVA_TOOL_OPTIONS
          when you launch java.
          1 person found this helpful
          • 2. Re: How to configure JRE?
            ptoye
            Thanks very much. But I've done a search in the Oracle documentation and got:
            We did not find any search results for: "_JAVA_OPTIONS"

            (Who's this guy "We"?)

            Googling wasn't much help either.

            Any hints as to where to find this info? I'd have thought it was something in the Java FAQ at least.
            • 3. Re: How to configure JRE?
              gimbal2
              it is not really a good idea to configure anything through command line variables; for one your application won't work out of the box when run on another machine until the variables are added there as well.

              During development it is a good idea to use a tool like ANT to build and run your applications; ANT can also manage the command line parameters passed to the java executable and it makes the whole deal of building, testing and packaging an application easier as well - once you learn to use the tool of course, which is not entirely trivial. Next to ANT you also have Maven, which is an even more versatile tool that can also manage all application dependencies for you but it has an even steeper learning curve; be warned.

              When deploying your application it is good to create shell scripts that invoke the application in the way you need it to. Alternatively you could use a jar wrapper tool to create a native executable that does it. Yet another alternative is to use Java webstart. Whatever you do, you do not want people to have to learn specifics of Java or command prompt mechanics just to be able to run your stuff!
              • 4. Re: How to configure JRE?
                tschodt
                ptoye wrote:
                ... I've done a search in the Oracle documentation and got:
                ... did not find any search results for: "_JAVA_OPTIONS"

                Googling wasn't much help either.

                Any hints as to where to find this info?
                I'd have thought it was something in the Java FAQ at least.
                You say you searched, but you do not say what additional information you are looking for.
                What kind of results did Google return?
                How do these results differ from what you expected?
                • 5. Re: How to configure JRE?
                  802889
                  I am not 100% sure, but you might be able to set this in net.properties in the <jre>/lib folder
                  • 6. Re: How to configure JRE?
                    ptoye
                    (answering gimbal2)
                    Well, my problem appears to be dependent on the computer configuration - if I switch off the firewall(Outpost) it works OK, but I don't do that for long. On the Outpost forum, users of the same firewall have had trouble with Java 7.and the blame seems to point towards Java rather than Outpost.

                    But Netbeans can't communicate either, which is really serious. That's why I want a solution for my machine, not anyone else's.

                    Edited by: ptoye on 29-Sep-2011 04:37
                    • 7. Re: How to configure JRE?
                      ptoye
                      (answering tschodt)
                      I searched for "_JAVA_OPTIONS". Some of the results hint that the format needed would be something like -Djava.net.preferIPv4Stack=true but I'd hoped that there'd be a link there to some sort of Java tutorial which actually tells you how to configure the parameters without having to guess.

                      Edited by: ptoye on 29-Sep-2011 04:38
                      • 8. Re: How to configure JRE?
                        ptoye
                        (Answering TheAvalanche)
                        Hmmm. The first few lines say

                        # For now, only the various proxy settings can be configured here.

                        which isn't encouraging.

                        Also, because Java is installed in the "program Files" folder no-one, not even an administrator, can edit it. Well done Microsoft. I don't have time now to deinstall Java, reinstall it in another folder and start all over again.

                        Nice idea, though. Thanks.

                        Edited by: ptoye on 29-Sep-2011 04:38
                        • 9. Re: How to configure JRE?
                          darke
                          ptoye wrote:
                          Also, because Java is installed in the "program Files" folder no-one, not even an administrator, can edit it.
                          I doubt that .

                          BTW , You can reply to specific posts using the Reply button.
                          • 10. Re: How to configure JRE?
                            802889
                            ptoye wrote:
                            (Answering TheAvalanche)
                            Hmmm. The first few lines say

                            # For now, only the various proxy settings can be configured here.

                            which isn't encouraging.
                            True
                            Also, because Java is installed in the "program Files" folder no-one, not even an administrator, can edit it. Well done Microsoft. I don't have time now to deinstall Java, reinstall it in another folder and start all over again.
                            An administrator can edit files in Program Files, but he will first need to start his editor using 'Run as Administrator' in the context menu of the application icon, and then open the file from within the editor.
                            • 11. Re: How to configure JRE?
                              tschodt
                              ptoye wrote:
                              I searched for "_JAVA_OPTIONS".
                              Some of the results hint that the format needed would be something like -Djava.net.preferIPv4Stack=true but
                              I had hoped there would be a link to some sort of
                              Java tutorial which actually tells you how to configure the parameters without having to guess.
                              Are you asking if specifying -Djava.net.preferIPv4Stack=true when launching Java sets the java.net.preferIPv4Stack parameter to true?
                              Can you devise a way to determine if specifying -Djava.net.preferIPv4Stack=true does what you want?
                              Can you devise a way to determine if adding -Djava.net.preferIPv4Stack=true to the JAVAOPTIONS env. var. does what you want?
                              • 12. Re: How to configure JRE?
                                ptoye
                                Sorry, not making myself clear.

                                1) No - even I'd have taken that as obvious.

                                2) No - I can find out what works by running my simple program.

                                3) No - as (2). I've tried it and it doesn't work.

                                I've also tried adding that string to the runtime parameters in the java configuration mechanism from the control panel. But what is the syntax? That's why I'm asking if there's any form of tutorial or documentation on configuring Java. Obviously any help here in actually getting it to work is gratefully received. But the inability of Oracle (probably inherited from Sun) to provide what I'd have thought was fairly basic information is a bit discouraging. After all, they're in competition with MS and their Visual Studio products, and have to do better to compete.
                                • 13. Re: How to configure JRE?
                                  tschodt
                                  ptoye wrote:>
                                  I searched for "_JAVA_OPTIONS".
                                  Some of the results hint that the format needed would be something like -Djava.net.preferIPv4Stack=true but
                                  I had hoped there would be a link to some sort of
                                  Java tutorial which actually tells you how to configure the parameters without having to guess.
                                  tschodt wrote:
                                  Are you asking if specifying -Djava.net.preferIPv4Stack=true when launching Java sets the java.net.preferIPv4Stack parameter to true?
                                  1) No - even I'd have taken that as obvious.
                                  Can you devise a way to determine if specifying -Djava.net.preferIPv4Stack=true does what you want?
                                  2) No - I can find out what works by running my simple program.
                                  Can you devise a way to determine if adding -Djava.net.preferIPv4Stack=true to the JAVAOPTIONS env. var. does what you want?
                                  3) No - as (2). I've tried it and it doesn't work.
                                  It works fine for me, both on Windows and on Linux (as well as on Solaris).

                                  When I add -Djava.net.preferIPv4Stack=true to JAVAOPTIONS and run Java I get
                                  C:\>java -version
                                  Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
                                  java version "1.6.0_26"
                                  Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
                                  Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
                                  How do you add -Djava.net.preferIPv4Stack=true to the JAVAOPTIONS env. var. ?

                                   
                                  I've also tried adding that string to the runtime parameters in the java configuration mechanism from the control panel.
                                  There are two contexts you configure env.vars for in the control panel; Java Applets and Java Webstart.
                                  This is only for Java applications launched in one of those contexts.
                                  But what is the syntax?
                                  The syntax of what? Where?
                                  That's why I'm asking if there's any form of tutorial or documentation on configuring Java.
                                  Once we establish what specific information you are looking for we can probably find plenty of tutorials that cover it.
                                  At this time I am still trying to determine exactly what information you are looking for.
                                  Obviously any help here in actually getting it to work is gratefully received. But the inability of Oracle (probably inherited from Sun) to provide what I'd have thought was fairly basic information is a bit discouraging.
                                  I cannot comment. Yet. I still don't know what information you are looking for.
                                  After all, they're in competition with MS and their Visual Studio products, and have to do better to compete.
                                  Are you talking about an IDE? Like eclipse or Netbeans (which are free)?
                                  • 14. Re: How to configure JRE?
                                    ptoye
                                    Firstly, I'm sorry that I'm not making myself clear.

                                    Secondly, thanks for showing me the syntax that I was looking for: setting JAVAOPTIONS to -Djava.net.preferIPv4Stack=true in my environment variables works fine. At last. Beforehand I must have mistyped something.

                                    Thirdly, the syntax I was asking about was what to put into JAVAOPTIONS. There are at least three obvious answers:
                                    -Djava.net.preferIPv4Stack=true
                                    Djava.net.preferIPv4Stack=true
                                    java.net.preferIPv4Stack=true

                                    of which the first seems to be the correct one.

                                    And it was the apparent lack of documentation on this simple fact that I was asking about. As I said, JAVAOPTIONS brings up no meaningful search result on the Oracle site. As well as taking an age.

                                    4thly, I was referring to the whole bundle - language + run-time system + IDE.

                                    5thly, how do you get this forum to reply to a message and include the message being replied to? You seem to be able to do it, but I can't find the button and it's not in the FAQ.

                                    Edited by: ptoye on 03-Oct-2011 07:35
                                    1 2 Previous Next