How to Solve Jdk Issue Unexpected At This Time

How to solve JDK issue unexpected at this time

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

Maven not running with Java 10: Files\Java\jdk-10""=="" was unexpected at this time

The messages start with "Files\Java\jdk-10" which seems to indicate you have not quoted your JAVA_HOME correctly. The correct syntax would be something like

set "JAVA_HOME=c:\Program Files\Java\jdk-10"
set "PATH=%JAVA_HOME%\bin;%PATH%"

And then

java -version

should function without specifying additional arguments on the command line (as should maven).

cmd error "Common was unexpected at this time" to run Spark with Java

During the installation of Java, relevant information has been written into the windows registry,Moving the installation directory directly will cause the program to be unusable.

It is recommended to uninstall and reinstall in the control panel, and specify a directory without spaces.

Thank you!

Maven - "files was unexpected at this time"

Finally I was able to resolved the issue.

A quoted value in the user variables has caused to the "Files were unexpected at this time" error in maven.

I spent hours of time with changing Java_home and M2_home variables with different combinations but finally checked the user variable and noted the quotes there.

Home = "C:\Program Files (x86)\Git\bin"

Removed the quotes and change the git home variable as below and now all works fine. :)

Home = C:\Program Files (x86)\Git\bin

This is where the error was



Related Topics



Leave a reply



Submit