7

I use Windows OS with English language and US keyboard setting. I use this command to generate keystore. It works fine.

C:\java6\jre\bin\keytool -genkey -keyalg RSA -alias mykey -validity 3652 -keystore C:\mykeystore -storepass 111111111 < data.txt

The data.txt

My name
My org unit
My org
My city
My state
ch
yes

However, this program cannot work normally on Windows with German language and keyboard setting. I must change the word "yes"" to "ja" in data.txt to make it works.

It isn't good to modify the data.txt.

Is there any way to set English as default language for keytool?

1
  • I found out that we can force Java to use English as default language by adding -J"-Duser.language=en" Commented Aug 14, 2013 at 10:45

1 Answer 1

20

In a nutshell you must pass the -Duser.language=en option to the Java machine. I know of two ways to do this:

  1. For just one invocation, specify the -J-Duser.language=en option on the keytool command line, e.g.

    keytool -J-Duser.language=en -genkey -keyalg RSA -alias mykey -validity 3652 -keystore C:\mykeystore -storepass 111111111 < data.txt
    

    See also SO: Forcing the use of english in JDK7 tools

  2. To change Java language globally, set the JAVA_TOOL_OPTIONS environment variable to have the -Duser.language=en value.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, I found it :)
The -J-Duser.language=en parameter does not seem to be understood by keytool.exe on Windows. The approach via JAVA_TOOL_OPTIONS however works fine.
Option 1 works perfectly in Cygwin, thanks.
keytool.exe on Windows: I have found that you just need to add quotes, e.g. -J"-Duser.language=en"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.