java 如何删除 JVM 属性“https.proxyHost”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35520337/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 00:12:41  来源:igfitidea点击:

How to remove JVM property "https.proxyHost"?

javaandroidhttpsproxy

提问by silverFoxA

I was using proxy on my system for some purpose. But now I don't have any proxy set on my system as well as from the Android Studio proxy settings I have removed the proxy and set it to no proxy.

我出于某种目的在我的系统上使用代理。但是现在我的系统上没有设置任何代理,并且从 Android Studio 代理设置中我删除了代理并将其设置为无代理。

But I keep getting the following error:

但我不断收到以下错误:

You have JVM property "https.proxyHost" set to .... This may lead to incorrect behavior. Proxy should be set in Settings|HTTP Proxy

您将 JVM 属性“https.proxyHost”设置为 ...。这可能会导致不正确的行为。代理应在设置|HTTP 代理中设置

As well when I try to build/sync the Gradle file without proxy server the files doesn't get compiled and says please check your network connection where I have internet connection.

同样,当我尝试在没有代理服务器的情况下构建/同步 Gradle 文件时,这些文件不会被编译并说请检查我有互联网连接的网络连接。

回答by silverFoxA

If anyone still looking for the solution to the same, here is what worked for me

如果有人仍在寻找相同的解决方案,这对我有用

JAVA_OPTS="$JAVA_OPTS -DsocksProxyPort"

for removing http proxy ports

用于删除 http 代理端口

Source http://mxw.pl/blog/?p=4

来源http://mxw.pl/blog/?p=4

回答by Amresh Deshpande

Using a Mac:

使用 Mac:

Go to Network settings -> Advanced -> Proxiesand uncheck "proxy server required password" for both HTTP and HTTPS. Remove user name and password.

转到Network settings -> Advanced -> Proxies并取消选中 HTTP 和 HTTPS 的“代理服务器所需密码”。删除用户名和密码。

In IntellJ/Android Studio restart with File -> Invalidate and Restart -> Just Restart

在 IntellJ/Android Studio 中重启 File -> Invalidate and Restart -> Just Restart

回答by Iman Marashi

I solved this problem by this solution:

我通过这个解决方案解决了这个问题:

On Windows:

在 Windows 上:

Go to your User Folder- on Windows 7/8 this would be:

转到您的用户文件夹- 在 Windows 7/8 上,这将是:

[SYSDRIVE]:\Users\[your username](ex. C:\Users\Iman\)

[SYSDRIVE]:\Users\[your username](例如C:\Users\Iman\

In this folder there should be a folder called .AndroidStudioBetaor .AndroidStudio(notice the period at the start - so on some OSes it would be hidden).

在这个文件夹中应该有一个名为.AndroidStudioBetaor的文件夹.AndroidStudio(注意开头的句点 - 所以在某些操作系统上它会被隐藏)。

Delete this folder (or better yet, move it to a backup location - so you can return it if something goes wrong).

删除此文件夹(或者更好的是,将其移动到备份位置 - 这样如果出现问题,您可以将其返回)。

This should reset your Android Studio settings to default.

这应该将您的 Android Studio 设置重置为默认值。

回答by daroubaozi

select Help -> Edit Custom VM Optionsadd below:

选择Help -> Edit Custom VM Options添加如下:

-Dhttp.proxyHost
-Dhttp.proxyPort
-Dhttps.proxyHost
-Dhttps.proxyPort
-DsocksProxyHost
-DsocksProxyPort

回答by paperhs

on Mac: goto System Preferences, Java -> open java control pan -> general -> Network Settings -> choose 'Direct Connection' enter image description here

在 Mac 上:转到系统偏好设置,Java -> 打开 Java 控制盘 -> 常规 -> 网络设置 -> 选择“直接连接” enter image description here