Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How do I set theses inputs to be used by the JVM?

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How do I set theses inputs to be used by the JVM?

    Hi ,
    I know Many times, a Java app needs
    to connect to the Internet. The
    most common example happens
    when it is reading an XML file
    and needs to download its
    schema . I know how to set the proxy but not i look for how to set these inputs , look at this picture http://s28.postimg.org/qe2saseml/SC20140505_205848.png


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How do I set theses inputs to be used by the JVM?

    Show your code that tries to do what you've described and any errors you're trying to overcome.

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I set theses inputs to be used by the JVM?

    ...
    public void setProxy
    () {
        if
    (isUseHTTPProxy()) {
            // HTTP/
    HTTPS Proxy
    System.setProperty
    ("http.proxyHost",
    getHTTPHost());
    System.setProperty
    ("http.proxyPort",
    getHTTPPort());
    System.setProperty
    ("https.proxyHost",
     getHTTPHost());
    System.setProperty
    ("https.proxyPort",
     getHTTPPort());
            if
    (isUseHTTPAuth()) {
                String
    encoded = new String
    (Base64.encodeBase64
    ((getHTTPUsername()
    + ":" +
    getHTTPPassword
    ()).getBytes()));
                con.
    setRequestProperty
    ("Proxy-
    Authorization",
    "Basic " +
    encoded);
    Authenticator.
    setDefault(new
    ProxyAuth
    (getHTTPUsername(),
    getHTTPPassword()));
            }
        }
        if
    (isUseSOCKSProxy())
    {
            // SOCKS
    Proxy
    System.setProperty
    ("socksProxyHost",
    getSOCKSHost());
    System.setProperty
    ("socksProxyPort",
    getSOCKSPort());
            if
    (isUseSOCKSAuth()) {
                System.
    setProperty
    ("java.net.socks.
    username",
    getSOCKSUsername());
    System.setProperty
    ("java.net.socks.
    password",
    getSOCKSPassword());
    Authenticator.
    setDefault(new
    ProxyAuth
    (getSOCKSUsername
    (), getSOCKSPassword
    ()));
            }
        }
    }
    ...
    public class
    ProxyAuth extends
    Authenticator {
        private
    PasswordAuthenticati
    on auth;
        private
    ProxyAuth(String
    user, String
    password) {
            auth = new
    PasswordAuthenticati
    on(user, password
    == null ? new char
    []{} :
    password.toCharArray
    ());
        }
        protected
    PasswordAuthenticati
    on
    getPasswordAuthentic
    ation() {
            return auth;
        }
    }
    ...

    In fact , i'd like to add others inputs such as inject querry /url , inject host and port like in the picture but i need help

Similar Threads

  1. No JRE or JDK in JVM
    By Jobrien15 in forum Computer Support
    Replies: 7
    Last Post: October 1st, 2013, 07:40 PM
  2. how to install the JVM?
    By warnexus in forum Java IDEs
    Replies: 3
    Last Post: September 1st, 2011, 10:33 AM
  3. does anyone know assembly code for JVM?
    By javapenguin in forum Other Programming Languages
    Replies: 2
    Last Post: April 6th, 2011, 02:16 AM
  4. JVM Generations
    By Hema26 in forum Java Theory & Questions
    Replies: 1
    Last Post: June 17th, 2010, 08:41 AM