libgdx没有使用正确的JAVA_HOME路径 [英] libgdx not using correct JAVA_HOME path

查看:148
本文介绍了libgdx没有使用正确的JAVA_HOME路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多关于JAVA_HOME的问题,我以前肯定已经完成了。我已经设置并运行了多年的java代码。

I know there are plenty of questions on JAVA_HOME and I've certainly worked through it before. I've been setting up and running java code for years.

我的理解是libgdx需要一个到jdk bin的路径,而不是一个jre bin。当我尝试创建一个小测试文件时,收到以下错误:

It's my understanding that libgdx needs a path to a jdk bin, rather than a jre bin. When I tried to create a little test file, I received the following error:

错误:JAVA_HOME设置为无效目录:C:\Program Files \ Java \ jre7 \ bin

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jre7\bin

无效目录指向一个jre bin,所以我下载了一个jdk并将其路径添加到我的环境变量中,用分号分隔。

The invalid directory points to a jre bin, so I downloaded a jdk and added its path to my environment variables, separated by a semicolon.

C:\Program Files\Java\jdk1.7.0_40\bin; C:\Program Files\Java \ jre7 \ bin

C:\Program Files\Java\jdk1.7.0_40\bin;C:\Program Files\Java\jre7\bin

但是当我再次运行libgdx时,我得到了同样的错误。重新启动计算机无效后,我尝试手动检查所有环境变量的命令提示符。虽然我的计算机>属性>高级系统设置>环境变量路径仍设置为包含两个目录,但cmd提示告诉了另一个故事。

but when I ran libgdx again, I got the same error. After restarting my computer to no avail, I tried checking my command prompt manually for all my environment variables. While my Computer > Properties > Advanced System Settings > Environment Variables path was still set to include both directories, the cmd prompt told a different story.

JAVA_HOME = C:\ Program Files\Java\jre7\bin

JRE_HOME = C:\Program Files\Java \ jre7 \ bin

JAVA_HOME=C:\Program Files\Java\jre7\bin
JRE_HOME=C:\Program Files\Java\jre7\bin

所以我尝试手动设置这些值将它们改变为它们应该是什么。首先(没有看到JRE_HOME作为单独的变量)我添加了一个分号和jdk路径到JAVA_HOME,使其与我的GUI环境变量路径中的匹配。当失败时,我就这样分开了

So I tried manually setting these values to change them to what they should be. First (having not seen JRE_HOME as a separate variable) I added a semicolon and the jdk path to JAVA_HOME to make it match what was in my GUI environment variables path. When that failed, I separated them like so

JAVA_HOME = C:\Program Files\Java \ jdk1.7.0_40 \ bin

JRE_HOME = C:\Program Files\Java\jre7\bin

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_40\bin
JRE_HOME=C:\Program Files\Java\jre7\bin

这对我的问题也没有帮助。错误消息未更改。我不太确定此时还有什么可做的,没有其他在线资源似乎可以回答这个特殊问题。希望堆叠的优秀人员能够应对挑战!

Which also has not helped my problem. The error message has not changed. I'm not quite sure what else to do at this point and no other online source seems to answer this particular problem. Hopefully the fine folks at stack are up to the challenge!

谢谢!

推荐答案

我也有同样的问题。您需要删除 \bin 。此外,如果更改 JAVA_HOME 环境变量,则需要重新启动Libgdx项目生成器,否则它将不使用最新的变量值。

I had the same problem too. You need to remove \bin. Also, if you change the JAVA_HOME environment variable, you'll need to restart the Libgdx Project Generator, otherwise it will not use the latest variable value.

您只需在 PATH 变量中包含 \ bin

You'll only have to include \bin inside the PATH variable.

这篇关于libgdx没有使用正确的JAVA_HOME路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆