I am running on a 64 bit installation of Windows 7 and am calling System.getenv("programfiles") which is returning C:\Program Files (x86) instead of C:\Program Files. I have also noticed that when I run the same code using run in IntelliJ it returns C:\Program Files like it should. I assume this is because it is inheriting environment variables from IntelliJ but I would like to be able to get both the 32 and 64 bit versions from a standalone application. What is causing this and what can I do to fix it?
我正在运行Windows 7的64位安装,并且正在调用System.getenv(“程序文件”),它将返回c:2的程序文件(x86),而不是C:\程序文件。我还注意到,当我运行相同的代码使用运行在IntelliJ它返回C:\Program Files应该喜欢它。我假设这是因为它从IntelliJ继承了环境变量,但是我希望能够从一个独立的应用程序中获得32和64位版本。是什么导致了这个问题,我能做些什么来修复它呢?
1 个解决方案
#1
1
The most probable reason for it returning x86 folder is that you are executing the standalone app with 32 bit JDK. Can you double check your JAVA_HOME
and JRE_HOME
environment variables? or do a quick java -version
.
它返回x86文件夹的最可能的原因是,您正在用32位JDK执行独立的应用程序。您能再次检查您的JAVA_HOME和JRE_HOME环境变量吗?或者做一个快速的java版本。
Also, perhaps this question will help: Java - get "program files" path
另外,这个问题可能会有所帮助:Java—获取“程序文件”路径。
#1
1
The most probable reason for it returning x86 folder is that you are executing the standalone app with 32 bit JDK. Can you double check your JAVA_HOME
and JRE_HOME
environment variables? or do a quick java -version
.
它返回x86文件夹的最可能的原因是,您正在用32位JDK执行独立的应用程序。您能再次检查您的JAVA_HOME和JRE_HOME环境变量吗?或者做一个快速的java版本。
Also, perhaps this question will help: Java - get "program files" path
另外,这个问题可能会有所帮助:Java—获取“程序文件”路径。