为什么我不能将 JAVA_HOME 和 JRE_HOME 设置为其他值?
我正在运行 ubuntu,而 djatoka(在 tomcat 中运行)无法与 OpenJDK 一起使用。因此,我将 JAVA_HOME 和 JRE_HOME 设置为我下载并导出变量的 Sun java。当我启动 tomcat 时,它会将 JRE_HOME 报告为我设置的内容。
然而,当我实际查看这些变量时,它们指向 OpenJDK,而 djatoka 不起作用。我找不到任何对其进行硬编码的地方,即使我将变量分配放在 catalina.sh 中并从那里导出,也会发生同样的事情。
到底是怎么回事?谢谢,
凯尔
I'm running ubuntu and djatoka (which runs in tomcat) won't work with OpenJDK. So I set JAVA_HOME and JRE_HOME to the Sun java that I downloaded and exported the variables. When I start tomcat, it reports JRE_HOME to what I set.
However, when I actually look at the variables, they're pointing to OpenJDK and djatoka isn't working. I can't find anyplace where it's being hardcoded, and even when I drop the variable assignments in catalina.sh and export from there, the same thing happens.
What the heck is going on? Thanks,
kyle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也可以在
/etc/environment
中设置。例如:JAVA_HOME=/usr/lib/jvm/java-6-sun
https://help.ubuntu.com/community/EnvironmentVariables#System-wide环境变量
You can also set it in
/etc/environment
. eg:JAVA_HOME=/usr/lib/jvm/java-6-sun
https://help.ubuntu.com/community/EnvironmentVariables#System-wide environment variables
您使用什么操作系统?尝试确保您为整个系统而不是用户设置这些环境变量。
What operating system are you using? Try making sure you are setting those environment variables for the entire system and not the user.
Ubuntu 使用某种有线
替代
系统。 /usr/bin 中的程序指向 /etc/alternatives,然后从那里转到 /usr/share/jdk-something。有一个简单的方法:卸载 OpenJDK 和 GCJ。但您可能会遇到依赖性问题。
或者阅读替代系统。
应该有帮助。这并不难。有点复杂——仅此而已。
我应该补充一点,替代系统的好处是,您可以并行安装多个 java(1.5、1.6、1.7 alpha、OpenJDK),并用一个命令切换所有链接 - 到 java、javac、appletviewer、javap等等。 afaik,不要忘记 CLASSPATH。 Ubuntu 完美地处理了从 1.6.23 到 1.6.24 的更新。但追踪链接到其根源是很烦人的。
甚至还有一个替代方案的 Java 快捷方式:
Ubuntu uses a somewhat wired
alternatives
system. Program in /usr/bin point to /etc/alternatives and from there it goes to /usr/share/jdk-something.There is an easy way: Uninstall the OpenJDK and GCJ. But you might run into dependency-issues.
Or read about the alternatives-system.
should help. It's not that hard. A little complicated - that's all.
I should add, that the benefit of the alternatives system is, that you can have multiple installations of java in parallel (1.5, 1.6, 1.7 alpha, OpenJDK) and switch with one command all the links - to java, javac, appletviewer, javap and so on. Not to forget the CLASSPATH, afaik. And Updates from 1.6.23 to 1.6.24 are handled by Ubuntu flawlessly. But it is annoying to trace the links down to their root.
There is even a Java-shortcut for the alternatives: