0

Hi everyone im trying to set the proxy for java but Im getting an error.

im using powershell to run these commands:

enter image description here

this is the command im using for setting the proxy:

Java -Djava.net.useSystemProxies=true -Dhttps.proxyHost=squid.domain.com -Dhttps.proxyPort=3128 -Dhttp.proxyHost=squid.domain.com -Dhttp.proxyPort=3128

but I get this error: enter image description here

Error: Could not find or load main class .net.useSystemProxies=true

I was following this guide it dosent work for me How do I set the proxy to be used by the JVM

Do im missing something?

  • I am not sure exactly but your path to the package/classname is incorrect. – Varun P Apr 30 '22 at 07:09
  • i got it from the java documentation :S, do you have the correct one? – Manuel Villanueva Apr 30 '22 at 07:13
  • 1
    1) do not post text (only) as screenshot **¹** (I cannot read that error message); 2) try using the command prompt (*DOS box*), I suspect the PowerShell is *messing up* the arguments (e.g. misinterpreting `.`); 3) check documentation of PowerShell (if previous point helped) || **¹** [Why should I not upload images of code/data/errors when asking a question?](https://meta.stackoverflow.com/q/285551/16320675) – user16320675 Apr 30 '22 at 08:08
  • 2
    @user16320675 has advised what I would. If, for some reason, you *have* to use Powershell, try quoting the env vars, e.g. `'-Dfoo=bar'` – g00se Apr 30 '22 at 12:16
  • I have tried in cmd.exe but using: `Java -Djava.net.useSystemProxies=true -Dhttps.proxyHost=squid.domain.com -Dhttps.proxyPort=3128 -Dhttp.proxyHost=squid.domain.com -Dhttp.proxyPort=3128` but i get the list of the available parameters for java. in powershell i tried quoting the env vars and I also get the parameter list available for java. – Manuel Villanueva Apr 30 '22 at 18:40
  • I dont have a main a class, what im trying to do its telling to the JVM to use a proxy for every connection that it does. according to documentations using the java cli its the way to do it, that why I dont have a class. – Manuel Villanueva May 02 '22 at 21:57

0 Answers0