java “错误:JAVA_HOME 定义不正确。” 在构建 Jikes rvm

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

"Error: JAVA_HOME is not defined correctly." in building Jikes rvm

javajvmenvironment-variablesjava-homejikes

提问by HymanWM

When I built the Jikes RVM on Ubuntu, I got this error. Any idea?

当我在 Ubuntu 上构建 Jikes RVM 时,出现此错误。任何的想法?

bin/buildit localhost production
---> Config: production
/bin/bash --login -c  '/bin/bash --login -c  "   cd /home/Hyman/Programs/jikesrvm-3.1.2 &&  export JAVA_HOME=/opt/jdk1.6.0 &&   ant very-clean -Dhost.name=ia32-linux &&  ant check-components-properties -Dhost.name=ia32-linux -Dtarget.name=ia32-linux -Dcomponents.cache.dir=/home/Hyman/.buildit_components_cache  &&   ant -Dtarget.name=ia32-linux -Dconfig.name=production -Dhg.revision= -Dhost.name=ia32-linux -Dcomponents.cache.dir=/home/Hyman/.buildit_components_cache "' 
Error: JAVA_HOME is not defined correctly.
  We cannot execute /opt/jdk1.6.0/bin/java
Wed Jun 13 12:23:37 EDT 2012
===================== Summary =====================
Local   : /home/Hyman/Programs/jikesrvm-3.1.2
Build   : ubuntu:/home/Hyman/Programs/jikesrvm-3.1.2
Target  : ubuntu:/home/Hyman/Programs/jikesrvm-3.1.2
Start   : Wed Jun 13 12:23:37 EDT 2012
Config  : production [FAILED Wed Jun 13 12:23:37 EDT 2012]
===================================================

OS:

操作系统:

Linux ubuntu 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 06:07:29 UTC 2010 i686 GNU/Linux

Environmental Variables: PATH

环境变量:PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun-1.6.0.22/bin<

JAVA_HOME

JAVA_主页

/usr/lib/jvm/java-6-sun-1.6.0.22

I checked the javain the JAVA_HOME/bindirectory, it works. No matter how I change the environmental variables, the error kept complaining

我检查了javaJAVA_HOME/bin目录中,它的工作原理。无论我如何更改环境变量,错误一直在抱怨

"We cannot execute /opt/jdk1.6.0/bin/java".

“我们无法执行 /opt/jdk1.6.0/bin/java”。

It seems that I didn't modify the right "position".

看来我没有修改正确的“位置”。

回答by Triton Man

run this command:

运行这个命令:

find . -exec grep "jdk1.6.0" {} \;

To find out which file is setting JAVA_HOME to that path.

找出哪个文件将 JAVA_HOME 设置为该路径。

回答by Rorschach

While you build jikes you can either build it using ant or using the command you are using. If the JAVA_HOME problem is causing trouble use

在构建 jikes 时,您可以使用 ant 或使用您正在使用的命令构建它。如果 JAVA_HOME 问题导致麻烦使用

bin/buildit localhost production -j"path to your jvm directory"

-This is present in "/usr/bin/jvm".

- 这存在于“ /usr/bin/jvm”中。

Another method: There is bin/buildit.base_config in which path for JAVA_HOME is specifically mentioned. So under "# Default JAVA_HOME values" you can modify appropriate location, for example,

另一种方法:bin/buildit.base_config里面专门提到了JAVA_HOME的路径。所以在“ # Default JAVA_HOME values”下你可以修改适当的位置,例如,

global.javahome.ppc32-linux=/usr/lib/jvm/java-6-sun-1.6.0.26
global.javahome.ppc64-linux=/usr/lib/jvm/java-6-sun-1.6.0.26
global.javahome.ia32-linux=/usr/lib/jvm/java-6-sun-1.6.0.26
global.javahome.x86_64-linux=/usr/lib/jvm/java-6-sun-1.6.0.26

You can chose which you want to use. If not familiar with your architecture, modify all and now you can build without having to worry about your java path to be mentioned explicitly. For more detailed information checkthis blog

您可以选择要使用的。如果不熟悉您的体系结构,请修改所有内容,现在您可以构建而不必担心要明确提及您的 java 路径。有关更多详细信息,请查看此博客

I have also written a small article on how one can start to fiddle with Jikes

我还写了一篇关于如何开始摆弄 Jikes的小文章

回答by Artem Oboturov

It's JRE but not JDK. Install JDK and make JAVA_HOME pointing to it.

它是 JRE 但不是 JDK。安装 JDK 并使 JAVA_HOME 指向它。

回答by tk_

You might get this error due to couple of reasons. To fix this quickly please follow below steps,

由于几个原因,您可能会收到此错误。要快速解决此问题,请按照以下步骤操作,

First find the java location. To get a list of your installed Java platforms, run the following command from the terminal:

首先找到java位置。要获取已安装 Java 平台的列表,请从终端运行以下命令:

$ sudo update-alternatives --config java

Now set JAVA_HOME and PATH,

现在设置 JAVA_HOME 和 PATH,

$ export JAVA_HOME=<java_home>

$ export PATH=$JAVA_HOME/jre/bin:$PATH

Create the symlink

创建符号链接

$ sudo ln -s <java_home>/jre <java_symlink_path>

When we take your case as a example :

当我们以您的案例为例时:

$ sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.22/jre /opt/jdk1.6.0

Above command will create the symlink location where the system is trying to find in your issue.

上面的命令将创建系统试图在您的问题中找到的符号链接位置。

Finally do the try your app.

最后试试你的应用程序。