Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

[ERROR] JDK version 'javac' is not recognized as an internal or external command (Testing on Android)

Howdy there :)

I've made one Titanium app for desktop, and I decided to give a shot at making an Android app, since I hate Java with everything I have.

First I was getting the wonderful [ERROR] Error locating JDK: set $JAVA_HOME or put javac and jarsigner on your $PATH error, and I managed to fix that by setting JAVA_HOME in my System Environment Variables to the JDK directory (for me it was c:\Program Files (x86)\Java\jdk1.6.0_20).

Now that I got past that error (with the help of Kevin Whinnery) I'm now getting this error:

[INFO] Launching Android emulator...one moment
[INFO] Building TestPro1 for Android ... one moment
[ERROR] JDK version 'javac' is not recognized as an internal or external command,

And the emulator dies. Same result when testing it on my HTC Eris aswell. Any ideas?

— asked June 14th 2010 by Charles Zink
  • android
  • android app build wont run
  • installation titanium
  • titanium
  • titanium mobile
1 Comment
  • make sure that value for "PATH" variable includes the bin folder i.e C:\Java\jdk1.7.0\bin

    and the value for JAVA_HOME is C:\Java\jdk1.7.0….with out \bin

    — commented February 14th 2012 by Abrar Sair

9 Answers

  • After an hour, this is what worked for me:

    • set JAVA_HOME to c:\jdk (or any path with NO spaces)
    • set PATH=(previous values);c:\jdk\bin (no spaces and dont use variable names like %JAVA_HOME\bin%)
    • Close Titanium
    • Launch Titanium from command prompt with -clean option.
      eg: c:\>"C:\Program Files\Appcelerator\Titanium Studio\TitaniumStudio.exe" -clean

    Works!!!

    — answered February 7th 2012 by SAJJAN SARKAR
    permalink
    7 Comments
    • this one works =)

      — commented April 17th 2012 by Janis Pagal
    • how do set JAVA_HOME to c:\jdk (or any path with NO spaces) ??? where??

      — commented April 17th 2012 by Tony van Riessen
    • Hi, somebody said it in a previous comment, execute from root: dir /x c:
      It will show PROGRA~2 for "Program Files(x86)"

      — commented April 20th 2012 by Alexis Alulema
    • You mean to reinstall java to C? (not in program files?) as i guess

      — commented September 22nd 2012 by Ika Pkhakadze
    • ive done all the above bt it still brings the same error javac is not recognised as an internal or external command……… any solutions??

      — commented December 8th 2012 by skillz michael
    • For the no spaces issue when you are using "Program Files" as a folder, where JDK resides, use instead of "Program Files" "Progra~1"
      e.g. C:\Progra~1\Java\jdk1.6\

      — commented December 16th 2012 by Ali Elouafiq
    • Really good! It Works!
      Thanks

      — commented January 10th 2013 by David Martínez
  • Just wanted to summarize the solution as I faced the same problem. Like P Sweeney mentioned above, the JAVA_HOME variable should not contain spaces in the path. Run
    dir /x c:\
    to get the shortname for any folders that may contain spaces.

    For my machine the jdk path or JAVA_HOME was: c:\Program Files (x86)\Java\jdk1.6.0_29

    I updated JAVA_HOME to C:\Progra~2\Java\jdk1.6.0_29
    I also added the bin folder to the path variable %JAVA_HOME%\bin;

    — answered January 12th 2012 by G Vatas
    permalink
    1 Comment
    • Works as a charm!, thank you!

      — commented June 26th 2012 by Juan Ramirez
  • Looks like it's still not finding the JDK tools on your path - trying putting %JAVA_HOME%\bin on your system path.

    — answered June 14th 2010 by Kevin Whinnery
    permalink
    2 Comments
    • I have this same problem - sort of.

      I always get the 'not recognized' error, but sometimes the emulator runs anyway.

      When I try to run on the phone, I get the full error popup, with an additional note ".. detected, but 1.6 is required".

      I cannot run "javac" from the command prompt.

      These are my environment variables:

      JAVA_HOME = C:\Program Files\Java\jdk1.6.0_21

      Path = …(deleted for brevity)…;$JAVA_HOME\bin

      Please help … This is very frustrating :(

      — commented August 26th 2010 by Richard Brents
    • I had that problem.. the solution is to remove all spaces from the java path. So instead of having it located at:

      JAVA_HOME = C:\Program Files\Java\jdk1.6.0_21

      move the jdk folder to, for example:

      JAVA_HOME = C:\Java\jdk1.6.0_21

      it WILL work then :)

      — commented October 14th 2010 by P Sweeney
  • I have struggled with this same issue too,, removing spaces will fix some portion of this problem… but in my case, java.exe is found fine, but not javaC.exe … I looked in the bin of the java folder, and it's not there… somehow, jdk1.6.0_22 does not have javaC included… so now what to do? does anyone have this problem?

    — answered December 23rd 2010 by m m
    permalink
    0 Comments
  • Ok, please ignore my comments above…
    I went into java and realized I have only installed the runtime version… I removed java and installed the whole JDK and sure enough javac and jarsigner are in the bin folder…

    Good luck.

    — answered December 23rd 2010 by m m
    permalink
    0 Comments
  • I had that problem.. the solution is to remove all spaces from the java path. So instead of having it located at:

    JAVA_HOME = C:\Program Files\Java\jdk1.6.0_21

    move the jdk folder to, for example:

    JAVA_HOME = C:\Java\jdk1.6.0_21

    it WILL work then :)

    — answered October 14th 2010 by P Sweeney
    permalink
    0 Comments
  • i installed Java jdk1.7.0_03 to c:\Java but still get this error…. what is the solution?

    — answered April 10th 2012 by Tony van Riessen
    permalink
    3 Comments
    • it seems to be the Blackberry option i added somewhere which complains about the java error…. now i am installig software sdk for it.. hope it helps…

      — commented April 10th 2012 by Tony van Riessen
    • installed the sdk blackberry but still error: BlackBerry development requires a 'JAVA_HOME' setting in your system's environments,,, so how do i do this or how to remove blackberry option?

      — commented April 10th 2012 by Tony van Riessen
    • I think Titanium doesn't support jdk 1.7, you should work with 1.6, this wa sone of my problems and solved it by specifying the jdk 1.6 folder in the JAVA_HOME environment, also if you use a windows 64 bit os make sure you will install the 32 bit version of JDK 1.6, the 64 bit still not supported

      — commented January 8th 2013 by Francisco Armando Dueñas Rodríguez
  • I am also getting this issue.
    I have tried :

    • Moving the JDK folder to C:\Libs\jdk1.6.0_24,
    • Setting path & Java Home to this C:\Libs\jdk1.6.0_24, \n
    • Setting path to $JAVA_HOME\bin,
    • Closing and opening Titanium and running it with - clean.

    The thing http://developer.appcelerator.com/question/34701/error-jdk-version-javac-is-not-recognized-as-an-internal-or-external-command-testing-on-android#is still not working.

    — answered February 25th 2013 by Frog Man
    permalink
    0 Comments
  • May be you set the JAVA_HOME = C:\Program Files\Java\jdk1.6.0_21\bin
    check weather your java home is C:\Program Files\Java\jdk1.6.0_21

    — answered April 24th 2013 by Visuddha Karunaratne
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.