How to solve JDK issue unexpected at this time
Asked Answered
C

3

13

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:

\Java\jdk1.6.0_45 was unexpected at this time. Process Exit

I initiated the environment variables as below:

Variable Name JAVA_HOME

Variable Value "C:\Program Files (x86)\Java\jdk1.6.0_45"

So can you please assist in solving the issue.

Cherriecherrita answered 17/2, 2015 at 13:22 Comment(4)
It's the space in your pathname.Return
Set JAVA_HOME with the 8.3 short name of the directory.Leptospirosis
Do you mean in the Variable Value?Cherriecherrita
Should I replace the Program Files(x86) with the result and it will work fine?Cherriecherrita
L
30

Here are some ways to find the short name of a directory.

Windows CMD

dir /X "C:\Program Files (x86)*"

as VB script

' 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

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.

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

Leptospirosis answered 17/2, 2015 at 13:45 Comment(2)
Thanks, so the path will be "C:\PROGRA~2\Java\jdk1.6.0_45", Am I correct?Cherriecherrita
@Cherriecherrita Yes. I updated my answer to include this piece of information.Leptospirosis
G
1

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.

Gemmulation answered 30/10, 2017 at 6:47 Comment(0)
A
1
\ 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

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

Athenian answered 17/6, 2018 at 18:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.