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.
Asked
Active
Viewed 4,020 times
1 Answers
3
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.

Steampunkery
- 3,839
- 2
- 19
- 28
-
Assuming it's on the PATH, this is cross platform – OneCricketeer Oct 07 '17 at 15:27
-
True, but doesn’t it install to a place on the path? – Steampunkery Oct 07 '17 at 15:28
-
Depends on the installation method – OneCricketeer Oct 07 '17 at 15:30
-
Is it possible to run without using openvpn client or to create a custom client using java? – A.Aleem11 Oct 30 '18 at 06:57
-
I'm sure it's possible to create a VPN client using Java, and yes, there are other clients besides openvpn, but both of those are out of scope of this question. – Steampunkery Oct 30 '18 at 16:07