How to use Java client library behind proxy


I am behind a proxy server. How can I configure NetLicensing Java Client to use the proxy?


Proxy server act as an intermediate instance between your product using NetLicensing Java Client library and NetLicensing Server at

Java exposes a set of system properties that can be used to configure JVM-wide behaviour.

  • http.proxyHost – the hostname of the HTTP proxy server
  • http.proxyPort – the port number of the HTTP proxy server (default: 80)
  • http.nonProxyHosts - the hosts that should bypass proxy

There are several options available on how you can run your application behind proxy.

Command Line

Set the JVM flags http.proxyHost and http.proxyPort when starting your JVM on the command line. This is usually done in a shell script (in Unix) or bat file (in Windows).

Unix shell script example:

JAVA_FLAGS=-Dhttp.proxyHost= -Dhttp.proxyPort=6464 -Dhttp.nonProxyHosts="localhost||1.*.*.*|*‌​|etc"
java ${JAVA_FLAGS} ...


In case CLI option is not suitable, proxy properties can be set programmatically with System.setProperty() within your application:

System.setProperty("http.proxyHost", "");
System.setProperty("http.proxyPort", "6464");