Java 此时如何解决意外的JDK问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28562559/
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
How to solve JDK issue unexpected at this time
提问by user3407440
I need your assistant in configuring the Jdeveloper 11.1.3 in my machine. I installed it and I installed the JDK. When I tried to ran a sample jsf file " Right Click-> Run", it generates the error:
我需要你的助手在我的机器上配置 Jdeveloper 11.1.3。我安装了它并安装了JDK。当我尝试运行示例 jsf 文件“右键单击-> 运行”时,它会生成错误:
\Java\jdk1.6.0_45 was unexpected at this time. Process Exit
\Java\jdk1.6.0_45 这个时候出乎意料。进程退出
I initiated the environment variables as below:
我启动了如下环境变量:
Variable Name JAVA_HOME
变量名 JAVA_HOME
Variable Value "C:\Program Files (x86)\Java\jdk1.6.0_45"
变量值“C:\Program Files (x86)\Java\jdk1.6.0_45”
So can you please assist in solving the issue.
所以你能帮忙解决这个问题吗?
采纳答案by SubOptimal
Here are some ways to find the short name of a directory.
以下是查找目录短名称的一些方法。
Windows CMD
视窗 CMD
dir /X "C:\Program Files (x86)*"
as VB script
作为 VB 脚本
' usage: cscript shortname.vbs [directory]
'
' example: cscript shortname.vbs "C:\Program Files (x86)\Java\jdk1.6.0_45"
on error resume next
Set fso=CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(WScript.Arguments(0))
Set objSubFolders = objFolder.SubFolders
For Each sf In objSubFolders
WScript.Echo sf.ShortPath
Next
Set objFiles = ObjFolder.Files
For Each file In objFiles
WScript.Echo file.ShortPath
Next
Java using JNA
使用 JNA 的 Java
import com.sun.jna.Native;
import com.sun.jna.platform.win32.Kernel32;
public class LongToShort {
public static String GetShortPathName(String path) {
char[] result = new char[256];
Kernel32.INSTANCE.GetShortPathName(path, result, result.length);
return Native.toString(result);
}
// java LongToShort "C:\Program Files (x86)\Java\jdk1.6.0_45"
public static void main(String[] args) {
System.out.println(GetShortPathName(args[0]));
}
}
edit
编辑
Example how to change the JAVA_HOME environment variable.
Assuming your JDK is installed in C:\Program Files (x86)\Java\jdk1.6.0_45
.
The short name of C:\Program Files (x86)
might be PROGRA~1
.
示例如何更改 JAVA_HOME 环境变量。
假设您的 JDK 安装在C:\Program Files (x86)\Java\jdk1.6.0_45
.
的简称C:\Program Files (x86)
可能是PROGRA~1
。
Change your JAVA_HOME:
from set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_45
to set JAVA_HOME=C:\PROGRA~1\Java\jdk1.6.0_45
改变你的JAVA_HOME:
从set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_45
到set JAVA_HOME=C:\PROGRA~1\Java\jdk1.6.0_45
回答by user8854735
Copy the java files to a different drive, go to C:\program files-Java. Right click and copy the files, create a new folder on D drive. Ex; D:\File, paste the file. Goto Environmental Variable, select path and update, select "New" and enter D:\File\Java\jdk. Don?t give any semicolon on the existing path(Vshell1.0) Click on Config.cmd and wait for the configuration wizard to open. Hope it helps.
将 java 文件复制到不同的驱动器,转到 C:\program files-Java。右键复制文件,在D盘新建一个文件夹。前任; D:\File,粘贴文件。转到环境变量,选择路径和更新,选择“新建”并输入 D:\File\Java\jdk。现有路径(Vshell1.0)上不要加分号,点击Config.cmd,等待配置向导打开。希望能帮助到你。
回答by Pawan Maurya
\ Java \ jdk1.8.0_171 \ bin was unexpected at this time
or
或者
\Java\jdk1.7.0_25 was unexpected at this time.
While creating weblogic domain by using config.cmd might be this type of problem occurs
使用config.cmd创建weblogic域时可能会出现此类问题
to rectify this problem try to use java path as d:\Java\jdk1.8\bin
or any but avoid using lengthy dir jdk1.8.0_171 or jdk1.8.0_171
C:\Program Files (x86)\Java\jdk1.8.0_171\bin
要纠正此问题,请尝试使用 java path asd:\Java\jdk1.8\bin
或 any 但避免使用冗长的目录 jdk1.8.0_171 或 jdk1.8.0_171 C:\Program Files (x86)\Java\jdk1.8.0_171\bin