Start OpenVPN from Java application

Viewed 3699

Is it even possible to start OpenVPN trough Java application? If it is possible what is the best way to do it so it's cross-platform and works on all platforms that have OpenVPN installed.

1 Answers

You can run openvpn with Java like this:

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("openvpn your_config.ovpn");

This will run openvpn via the command line. It is cross platform, too, as it will work on Mac, Linux and Windows.

Related