1

I'm new on Stack Overflow so don't hold it against me if I make mistakes. Here is my problem, I created a simple Android app in Eclipse and when I try to run it I get this error :

Error generating final archive: Failed to create key: Cannot run program "D:\Program Files\Java\jre7\bin\keytool.exe": CreateProcess error=2, Le fichier spécifié est introuvable JAVA_HOME is set to: D:\Program Files\Java\jre7 Update it if necessary, or manually execute the following command: "D:\Program Files\Java\jre7\bin\keytool.exe" -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore C:\Users\Vincent.android\debug.keystore -storepass android LunarLander Unknown Android Packaging Problem

I have tried JDK 1.6 & 1.7 for x64 & x86 each time. I'm running Windows 7 Ultimate x64. I tried running keytool.exe (JRE and JDK version) with cmd.exe and the explorer but it says :

Windows cannot find "D:\Program Files\JAVA\jre7\bin\keytool.exe". Make sure you typed the name correctly, and then try again. To search for a file click the Start button, and then click search.

Thinking it was a problem with the space between "Program" and "Files", I tried installing the JDK in "D:\Java\jdk...".

EDIT :

I found the solution ! All you need to do is to delete keytool.exe from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options in the registry.

Vincent Kelleher
  • 492
  • 2
  • 6
  • 12

3 Answers3

2

You can use the following steps to add 'Java' to your Path.

http://java.com/en/download/help/path.xml

Ceetn
  • 2,728
  • 2
  • 25
  • 28
1

You need to add the "D:\Program Files\JAVA\jre7\bin" to the PATH system variable. Setting the JAVA_HOME is not enough to run stuff from the BIN folder. So just add the bin folder to PATH and then, in a "cmd" run "keytool" (from anywhere except the actual bin folder). If that works then it should from your code also.

Dan Iliescu
  • 435
  • 2
  • 7
  • The problem seems to come from windows because it says that keytool.exe can't be found and that I must check if the name is correct – Vincent Kelleher Nov 26 '12 at 15:37
0

Thanks guys but I already added "D:\Program Files\JAVA\jre7\bin\" to the PATH system variable and it didn't work.

My problem comes from the file itself because all the other files (javac.exe,etc) in "D:\Program Files\JAVA\jre7\bin\" work.

Vincent Kelleher
  • 492
  • 2
  • 6
  • 12