0

First up I want to describe my problem. I created a program which connects directly to a FTP-Server. Now I need to make it run behind a proxy as well.

While searching around I've found this thread: How do I set the proxy to be used by the JVM

As I understood, it is sufficient (under Raspbian) to set

export ftp_proxy="http://username:password@host:port/"

in /etc/environment

and write System.setProperty("java.net.useSystemProxies", "true"); into my code to make the program use the proxy.

Am I right?

MiEbe
  • 96
  • 8
  • 1
    have you tried it? – Alexander Mar 30 '18 at 21:53
  • not yet. At first I wanted to know whether I'm totally wrong or not – MiEbe Mar 30 '18 at 21:59
  • 2
    stackoverflow is not really the place where you go and ask "will this work" before you even tried anything... :-O But yes, in general, what you read there makes sense. This system property (`java.net.useSystemProxies`) will probably switch on usage of these proxy variables. – Alexander Mar 30 '18 at 22:02
  • the problem is that I can't really try it right away. – MiEbe Mar 30 '18 at 22:09
  • Because on my developing network theirs no proxy so a direct connection is enough – MiEbe Mar 30 '18 at 22:09
  • But if people think this might be a good way to go I'll try it soon on the live-system – MiEbe Mar 30 '18 at 22:11
  • See this article https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html – SteelToe Mar 30 '18 at 22:58

0 Answers0