Eclipse 项目范围的错误:警告:未设置环境变量 HOME。以下目录将用于存储 Git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19175089/
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-09-10 17:06:18  来源:igfitidea点击:

Eclipse project-wide error: Warning: The environment variable HOME is not set. The following directory will be used to store the Git

eclipsegitegit

提问by J. K.

Started Eclipse and got this error. How do I fix it?

启动 Eclipse 并出现此错误。我如何解决它?

Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Documents and Settings\Wizard'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

If any additional information is needed, let me know and I will provide it.

如果需要任何其他信息,请告诉我,我会提供。

采纳答案by Dinesh Prajapati

You need to set the JAVA_HOME variable in your system. Depends on your Operating system you can check for "How to set Environment variable?" and from that point you need to set environment variable

您需要在系统中设置 JAVA_HOME 变量。取决于您的操作系统,您可以检查“如何设置环境变量?” 从那时起,您需要设置环境变量

Variable Name : JAVA_HOME Value : Path of Java upto bin folder

变量名:JAVA_HOME 值:Java 到 bin 文件夹的路径

  1. In Windows 7, type "environment" at the start menu
  2. Select "Edit environment variables for your account"
  3. Click the "New" button.
  4. Enter "HOME" in the name field
  5. Enter "%USERPROFILE%" or some other path in the value field.
  6. Click OK, and OK again. You have just added the Home directory on Windows.
  1. 在 Windows 7 中,在开始菜单中键入“环境”
  2. 选择“为您的帐户编辑环境变量”
  3. 单击“新建”按钮。
  4. 在名称字段中输入“HOME”
  5. 在值字段中输入“%USERPROFILE%”或其他一些路径。
  6. 单击确定,然后再次确定。您刚刚在 Windows 上添加了主目录。

回答by M. Suscripto

The other answers don't contemplate that if you don't use Git, then you can entirely ignore this warning, along with the "EGit could not detect" one.

其他答案并没有考虑到如果您不使用 Git,那么您可以完全忽略此警告以及“EGit 无法检测到”警告。

But I know... obsessive minds can't just ignore... they NEED to fix it anyway, right?

但我知道......强迫症不能忽视......他们无论如何都需要解决它,对吧?

Then proceed:

然后继续:

  1. Go to "Window --> Preferences" menu
  2. Expand: "Team --> Git --> Confirmations and warnings"
  3. Uncheck the "Home directory" and "Git prefix" boxes
  4. Ok
  5. In the Workspace log, delete the old warnings (red cross icon)
  6. Restart Eclipse
  7. Feel the peace spreading through your mind... :)
  1. 转到“窗口->首选项”菜单
  2. 展开:“团队 --> Git --> 确认和警告”
  3. 取消选中“主目录”和“Git 前缀”框
  4. 好的
  5. 在工作区日志中,删除旧警告(红色十字图标)
  6. 重启 Eclipse
  7. 感受和平在你的脑海中蔓延...... :)

回答by Laurent.B

This is a warning because the HOME environment is not defined, whereas EGit (plugin for Git) need it to know where to locate the Git configuration and repository. By default it will use the current user base directory but the risk is that if you have Git installed at a different location, EGit and Git may have different behaviors. If you don't use Git, just deactivate the warning as explained.

这是一个警告,因为未定义 HOME 环境,而 EGit(Git 插件)需要它知道在哪里可以找到 Git 配置和存储库。默认情况下,它将使用当前用户基目录,但风险是如果您将 Git 安装在不同的位置,EGit 和 Git 可能会有不同的行为。如果您不使用 Git,只需按照说明停用警告。

Here is the EGit user guide : https://wiki.eclipse.org/EGit/User_Guide#Setting_up_the_Home_Directory_on_WindowsIt explains that you have to set the HOME variable with the %USERPROFILE% as value.

这是 EGit 用户指南:https://wiki.eclipse.org/EGit/User_Guide#Setting_up_the_Home_Directory_on_Windows 它说明您必须使用 %USERPROFILE% 作为值设置 HOME 变量。

You may check that too http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setupand Changing .gitconfig location on Windows

您也可以检查http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup在 Windows 上更改 .gitconfig 位置

回答by Jorge Bastida Cano

You should study the official documentation

你应该研究官方文档

Setting up the Home Directory on Windows

在 Windows 上设置主目录

Add the environment variable HOME to your environment variables.

将环境变量 HOME 添加到您的环境变量中。

In Windows 7:

在 Windows 7 中:

  1. type "environment" at the start menu.
  2. Select "Edit environment variables for your account".
  3. Under "User Variables", click the "New" button.
  4. Enter "HOME" in the name field.
  5. Enter "%USERPROFILE%" or some other path in the value field.
  6. Click OK, and OK again. You have just added the Home directory on Windows.
  1. 在开始菜单中输入“环境”。
  2. 选择“为您的帐户编辑环境变量”。
  3. 在“用户变量”下,单击“新建”按钮。
  4. 在名称字段中输入“HOME”。
  5. 在值字段中输入“%USERPROFILE%”或其他一些路径。
  6. 单击确定,然后再次确定。您刚刚在 Windows 上添加了主目录。

File > Exit, then restart the application.

文件 > 退出,然后重新启动应用程序。

回答by user2724604

This is because JEE package is lacking the Platform SDK. (there is "Eclipse Platform Plug-in Developer Resources" in Eclipse IDE for Eclipse Committers(former Eclipse Standard), but not in Eclipse IDE for Java EE Developers.) You can solve this bug by installing it manually from "The Eclipse Project Updates" site. (Help->Install New Software->choose "The Eclipse Project Updates"->uncheck "Group items by category"->select "Eclipse Platform Plug-in Developer Resources")

这是因为 JEE 包缺少 Platform SDK。(Eclipse 提交者(以前的 Eclipse 标准)的 Eclipse IDE 中有“Eclipse 平台插件开发人员资源”,但 Java EE 开发人员的 Eclipse IDE 中没有。)您可以通过从“Eclipse 项目更新”手动安装来解决此错误“ 地点。(帮助-> 安装新软件-> 选择“Eclipse 项目更新”-> 取消选中“按类别分组项目”-> 选择“Eclipse 平台插件开发人员资源”)

(for EGit warnings, they are just warnings and have no relation to this problem)

(对于EGit警告,它们只是警告,与此问题无关)

回答by user11324004

There is no need to set an environment variable HOMEor JAVA_HOMEfor the system or for any user. The required data can easily be given to eclipse or Git or EGit in a small script: - Use your brain to make out where the HOMEfor ecilpse or Git or EGit should be. You can choose any directory accessible for these programs. For example the directory is N:\somewhere\eclipse\HOME. - Examine the location of the executable eclipse file. - Open a new text file with the Editor or with your favourite text editor app on your desktop or in any directory you like. - Write the following text of 3 lines

有没有必要设置一个环境变量HOMEJAVA_HOME为系统或任何用户。所需的数据可以很容易地通过一个小脚本提供给 eclipse 或 Git 或 EGit: - 用你的大脑找出HOMEfor ecilpse 或 Git 或 EGit 应该在哪里。您可以选择这些程序可访问的任何目录。例如目录是N:\somewhere\eclipse\HOME. - 检查可执行 eclipse 文件的位置。- 使用编辑器或您喜欢的文本编辑器应用程序在您的桌面或您喜欢的任何目录中打开一个新的文本文件。- 写出以下 3 行文字

SET HOME=N:\somewhere\eclipse\HOME
start "Run Eclipse" "F:\ProgramFiles\eclipse\java-2019-03\eclipse\eclipse.exe"
EXIT
  • Here N:\somewhere\eclipse\HOMEis just an exmaple for any existing directory you choose. "Run Eclipse" is an example for the title of the script window. "F:\ProgramFiles\eclipse\java-2019-03\eclipse\eclipse.exe" is an example for the exclipe app to start.
  • save the text file as "RunEclipse.cmd"
  • By executing RunEclipse.cmd you set the HOME environment variable only for this script. eclipse.exe can get it from the script environment and the Error does not occur anymore.
  • 这里N:\somewhere\eclipse\HOME只是您选择的任何现有目录的示例。“Run Eclipse”是脚本窗口标题的示例。“F:\ProgramFiles\eclipse\java-2019-03\eclipse\eclipse.exe”是 exclipe 应用程序启动的示例。
  • 将文本文件另存为“RunEclipse.cmd”
  • 通过执行 RunEclipse.cmd,您仅为该脚本设置了 HOME 环境变量。eclipse.exe 可以从脚本环境中获取,不再出现错误。