ERROR] Error locating JDK: set $JAVA_HOME or put javac and jarsigner on your $PATH

You must Login before you can answer or comment on any questions.

OK - I have been struggling to get this working. I am on vista and have downloaded the sun stuff.

I get the above error when I launch kitchen sink. The kitchen sink does display sdk 1.6 at the bottom.

Exactly what do I do now?

%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:Program FilesNTRU CryptosystemsNTRU TCG Software Stackbin;C:Program FilesWave Systems CorpDell Preboot ManagerAccess Clientv5;C:Program FilesCommon FilesRoxio SharedDLLShared;C:Program FilesQuickTimeQTSystem;C:Program FilesCommon FilesIntuitQBPOSSDKRuntime

The above is my path

thanks,

======

Your solution worked - thanks

— asked 3 years ago by Dana Parks
2 Comments
  • I'm on XP and I had to change the path to C:\Progra~1\Java\jdk1.6.0_23\bin\; (NOTE - not the complete Program Files). However, after this change "javac" is working from command prompt but now Titanium immediately gives

    "[Error]: RequiredJarsigner not found [Error]:Required javac not found [Error]:Required java not found" I've restarted Titanium after every change. I even added "JAVA_HOME" to the Environment variable. I've it in both java_home and Path. Any ideas?

    — commented 2 years ago by rajesh ramamoorthy

  • I tried, but it still doesn't work on Window XP. I need help.

    — commented 8 months ago by michelle felt

33 Answers

Well, I got this one working about an hour ago, so I will try to pass along what little I figured out.

Right-click on "Computer" on the Vista Desktop. Select "Properties" then "Advanced System Settings" from the left-hand Tasks column. Then when "System Properties" opens, go to the "Advanced" tab and click on "Environment Variables". Go to "System Variables", select "Path" and then click on "Edit...". Put a semi-colon at the end of the path as it stands and then type the exact path to the "bin" directory of the JDK. For me, it was C:Program Files (x86)Javajdk1.6.0_20bin (with appropriate backslashes --for some reason this posting system doesn't display them??). You can tell whether you have succeeded by opening a Command Prompt (a fresh one opened AFTER editing the path) and typing "javac" from the prompt. If it fails, you will see "'javac' is not recognized as an internal or external command" etc., and you should check your editing of the path carefully. If it has succeeded, you will see a long "Usage" statement for javac. An interesting nuisance: if there is a space after the semi-colon and before the C: of the new path item, it doesn't work. Took me a while to guess that that might be a problem... Maybe it was always that way with path variables... I don't think I've edited the path in over ten years!

— answered 3 years ago by Frank Reed
answer permalink
18 Comments
  • This approach also worked for me in Windows 7 (JDK path was a little different, but the rest was "as-is")

    — commented 3 years ago by Andrew Mitchell

  • Thank you, worked like a charm! This saved me a lot of time!!

    — commented 3 years ago by Jesal Gadhia

  • Environment Variables are explained in the official Titanium Guides

    — commented 2 years ago by Paul Dowsett

  • Show 15 more comments

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 1 year ago by SAJJAN SARKAR
answer permalink
5 Comments
  • I'm on Xp and I did what Reto, down below, suggested. After that, I did a clean start of Titanium from cmdline and it WORKED! Thanks to both Sajjan and Reto.

    — commented 1 year ago by Prasang Chhetri

  • Great, that one worked as well for me. Thanks a lot!

    For those who wonder what to set for: c:\jdk

    If you installed the jdk in the default directory and you took version 1.6.0_20 for example the path has to look like:

    C:\Program Files (x86)\Java\jdk1.6.0_20

    — commented 1 year ago by Peter Schloensge

  • this is the only solution at the QA that affects my runtime := but it still not working , the consol gives me " '[INFO] logfile = D:\test_android\build.log a [DEBUG] E:\my road to programing\My road to tatunium\portale SDK installation\Titanium\mobilesdk\win32\1.8.2\android\builder.py emulator test_android E:\Androide workspace D:\test_android com.jivana 4 HVGA Traceback (most recent call last): File "E:\my road to programing\My road to tatunium\portale SDK installation\Titanium\mobilesdk\win32\1.8.2\android\builder.py", line 2065, in <module> s = Builder(project_name,sdk_dir,project_dir,template_dir,app_id) File "E:\my road to programing\My road to tatunium\portale SDK installation\Titanium\mobilesdk\win32\1.8.2\android\builder.py", line 244, in init android_creator.create(parent_dir, project_dir=self.top_dir, build_time=True) File "E:\my road to programing\My road to tatunium\portale SDK installation\Titanium\mobilesdk\win32\1.8.2\android\android.py", line 264, in create json_contents = open(os.path.join(template_dir,'dependency.json')).read() IOError: [Errno 2] No such file or directory: 'C:\\Users\\Mustafa Adel ELnagar\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\1.8.2\\android\\dependency.json' '

    — commented 1 year ago by Mustafa Elnagar

  • Show 2 more comments

Thank you Frank!

Holy cow, what an oddessy this has been to try and get an app set up.

I have exactly the same problem, but the jdk is on the path variable .. when i open a command prompt (cmd) and put javac -version into it, it gives me ...

C:\Users\mainuser>javac -version javac 1.6.0_21

This is the Output from the Path: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;F:\devzone\android-sdk\tools;F:\devzone\android-sdk\platforms\android-8\tools;F:\devzone\android-sdk\platforms\android-7\tools;F:\devzone\jdk1.6.0_21\bin

But when i try to start the emulator ... [ERROR] Error locating JDK: set $JAVA_HOME or put javac and jarsigner on your $PATH

Just had the same problem and fixed as per the suggestions above.

One tip: make sure you restart Titanium after you edit the path.

Thanks for posting this, it didn't completely help me, but it got me goin on the right way. I don't remember it saying anywhere that you need a JDK (Java Development Kit), I only saw that it needed the android SDK (Which you NEED 1.6, not just 2.1 and 2.2 like I had). I had a JRE (Java Runtime Environment) setup already for Eclipse, and that would run emulators no problem, but i guess for appcelerator they need the JDK instead of the JRE. They really need to work on their Getting Started documentation.

finally got it titanium studio to run, make sure ALL of the paths dont have spaces. I ended up using the old DOS style paths which turns "c:\Program Files (x86)" into "C:\Progra~2" in windows 7

— answered 2 years ago by josh tischer
answer permalink
3 Comments
  • nevermind it lied its not working... wtf. I have tried every combination of all of the guides and trials above. I even uninstalled the JDKx64 to use the JDKx86. paths with no spaces, uninstalled Titanium studio, re-installed.

    All of the apps in the path work, i.e. java, python, git, titanium etc. still getting the Java_Home error.

    [ERROR] Required jarsigner not found
    [ERROR] Required javac not found
    [ERROR] Required java not found
    [ERROR] One or more required files not found - please check your JAVA_HOME environment variable
    Can anyone help?

    Win 7: Titanium Studio w latest updates: Mobile SDK 1.7.0: JDK path: C:\Java\jdk1.6.0_25

    — commented 2 years ago by josh tischer

  • FYI

    I'm running Windows XP not sure which edition but the setup that worked for me is as follows:

    Environment Variables:

    Variable: android_sdk <br> Path: C:\Program Files\Android\android-sdk

    Variable: JAVA_HOME <br> Path: C:\Program Files\Java\jdk1.6.0_21

    Variable: Path <br> Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Git\cmd;%JAVA_HOME%

    NOTE

    Some instructions I found had the JAVA_HOME path as C:\Program Files\Java\jdk1.6.0_21\bin - I removed the "\bin" and now it works perfectly fine.

    — commented 2 years ago by Kurtis Thompson

  • this works for me, too! only write C:\java\jdk in JAVA_HOME without \bin und whitespaces or another path seperated with ;

    — commented 1 year ago by Tobi Brau

Windows 7 Fix after 7hrs craziness . So after installing the new version of Titanium Studio with SDK 1.7.1, I still had the same problems.

Turns out the the System Variables paths need the Full length of the path(C:\Program Files\Java\jdk1.6.0_26\bin), and in the User variable under JAVA_HOME its needs the short DOS version of the path (C:\progra~1\Java\jdk1.6.0_26)

NOTE: So any path under User, that are required by Titanium need to have the short DOS name. Anything under System need to have the full path name.

Hope this helps.

— answered 2 years ago by Erick Franco
answer permalink
1 Comment
  • Erick, I thought for sure you had the correct solution for this problem (in my case). I shortened the path like you described. Fail. I shortened all the paths... failed again. The odd thing is that javac, java and jarsigner all run from Titanium's terminal window...yet when I try to run an app, I get this error... <SUPER SIGH>

    — commented 2 years ago by Martin Sawyer

Hi all, I am on an old version of Windows XP. The above didn't work totally for me. The main difference, I ALSO had to:

[ In Windows XP, Select Start -> Control Panel -> System -> Advanced -> Environment Variables -> System variables -> PATH. ]

Prepend C:\Program Files\Java\jdk1.6.0_23\bin; to the BEGINNING of the PATH variable.

So thats in addition to the system variables etc as stated above. I found the solution

http://introcs.cs.princeton.edu/java/15inout/windows-cmd.html

Good luck. It took me 2 weeks (!) to install everything and get it working. Appcelerator / Java / Android is not an easy or intuitive development platform.

wow they should put some tutorial on this or more clearer step by step. guess they assume people will know what to do. been searching this for like 2 hours googling, finally find it here. thanks guys

Though a little bit different the same solution works for xp!! THanks Heaps

Here is another 100% working solution that works for me when JAVA_HOME was still not recognized by Titanium

Open Control Panel >> System >> Advanced >> Environment Variables

Click on NEW in the "User Variables" Variable Name: android_sdk Variable Value: the path to your android sdk

Click on NEW again Variable Name: JAVA_HOME Variable Value: the path to your java jdk

Now select "Path" in the System Variables , edit and append ";%JAVA_HOME%;%android_sdk%" to it

Under XP (you might need to enable show hidden files and folders in your explorer under Tools, Folder Options, View) to see it

C:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\

Under Vista/7 C:\ProgramData\Titanium\mobilesdk\win32

Click on the mobilesdk version that you're having trouble with open the "Android" folder right click on the filename "builder.py" and choose "Wordpad" overwrite everything inside "def set_java_commands(self):" to this:

def set_java_commands(self): self.jarsigner = "jarsigner" self.javac = "javac" self.java = "java"
found = False for path in os.environ['PATH'].split(os.pathsep): if os.path.exists(os.path.join(path, 'jarsigner.exe')) and os.path.exists(os.path.join(path, 'javac.exe')): self.jarsigner = os.path.join(path, 'jarsigner.exe') self.javac = os.path.join(path, 'javac.exe') self.java = os.path.join(path, 'java.exe') found = True break if not found: error("Error locating JDK: set $JAVA_HOME or put javac and jarsigner on your $PATH") sys.exit(1)

of course SAVE now you can run the emulator again

— answered 2 years ago by jd nguyen
answer permalink
2 Comments
  • overwrite def set_java_commands(self):

    not work! if u will try please backup original fiel first.

    — commented 2 years ago by Guntaphon Manit

  • I'm using XP SP3, the below work for me but not the editing of builder.py :

    Quote: - " Here is another 100% working solution that works for me when JAVA_HOME was still not recognized by Titanium

    Open Control Panel >> System >> Advanced >> Environment Variables

    Click on NEW in the "User Variables" Variable Name: android_sdk Variable Value: the path to your android sdk

    Click on NEW again Variable Name: JAVA_HOME Variable Value: the path to your java jdk

    Now select "Path" in the System Variables , edit and append ";%JAVA_HOME%;%android_sdk%" to it "

    But that's not complete yet, the JAVA_HOME path must remove the \bin ... eg . " Variable: JAVA_HOME <br> Path: C:\Program Files\Java\jdk1.6.0_21 " as mentioned by Kurtis Thompson below ... :)

    Thanks Guys

    — commented 1 year ago by walter cheah

For those of you that tried all the steps above in Windows 7 but couldn't get it to work. Here what finally worked for me.

in your Environment >> Path

put your entire jdk path like this c:\Progra~1\Java\jdk1.6.0_26\bin (my jdk version...yours could be different)

now you can verify the path by opening up a command prompt and type javac.exe -version again...it should find your jdk.

i spent a couple weeks on trying everything. Even modified the builder.py code to manually use the direct path, but always ran into problems. But with the above code it works.

any body know what is the actual solution for the above issue :P

I figure it out and it works fine for me now all what we have to do is just set the path as mentioned above and make sure that you are log out from titanium and log in again this is very important. hope this will help.

— answered 2 years ago by Rajesh CP
answer permalink
1 Comment
  • Just have to log out Titanium and Log back in again !!! Tried different solutions, and find original Frank's works, Thanks! I am on XP.

    — commented 1 year ago by Richard Wong

i fix this issue, but now when openning the android emulator it gaves me this error: ERROR: The process "5720" not found.

The emulator open anyway but i was wondering if this error can "hurt" in any way the app development... any one can help?

— answered 1 year ago by Tiago Ferreira
answer permalink
2 Comments
  • I also had the same issue when i am working in Windows, but it doesn't cause any damage for my application development so i didn't dig in detail.

    — commented 1 year ago by Rajesh CP

  • Yep, i´m on windows too, thats really my doubt if it can cause any damage to the application that i´m developing, an error its an error and something its not working right, so i´m trying to understand if i´m doing anything wrong, since i´m a newbie at titanium studio...

    Did you already finish and export an application and try-it on a mobile phone to see if anything its affected by this error?

    Thanks for your reply!

    — commented 1 year ago by Tiago Ferreira

I was able to fix this issue on Window 7 with these steps:

-1. Left click to our “Computer” Icon and click “Properties”.

-2. The window should appear with the Left Hand Side menu saying “Control Panel Home” , we will click the “Advanced System Settings”.

-3. A popup window appears after that, and then we click the button ” Environment Variables “.

-4. Another window appears and it is for Environment Variables, on the appear part of it, there is a list for System Variables . Let’s add variables or update our “path” variable if it is already existing.

-5. Click ”New” to create a variable JAVA_HOME with your java path ej. C:\Java\jdk1.6.0_20

-6. Edit your PATH variable and add at the begining %JAVA_HOME%; without "bin" because in builder.py the word bin is added.

I have tried everything in this posting and NONE of them have worked. No matter where I put it, whether it has spaces or not I get the same error. I am running win7 64-bit

Guys i got the answer.. it's so simple... just leave the ";" away at the end =) this was my problem after hours

— answered 1 year ago by Volker Weckbach
answer permalink
1 Comment
  • After at least an hour, it finally works after putting ; at the end on the line, thanks!! +1

    — commented 11 months ago by jp roz

Confirmed, this link sorted the problem out: http://developer.appcelerator.com/doc/mobile/mobile-build-windows

I deleted titanium studio pretty much immediatly after having this error and fixing it. If you make a complete IDE but cant give the option do this properly other than editing windows path variables, I lost all confidence in the product. I am programming in Eclipse nowadays.

Well, I got this one working about an hour ago, so I will try to pass along what little I figured out. Right-click on "Computer" on the win7 laptop. Select "Properties" then "Advanced System Settings" from the left-hand Tasks column. Then when "System Properties" opens, go to the "Advanced" tab and click on "Environment Variables". Go to "System Variables", select "Path" and then click on "Edit..."variable name as path and variable.value Put a semi-colon at the end of the path as it stands and then type the exact path to the "bin" directory of the JDK. For me, it was C:Program Files (x86)Javajdk1.6.0_20bin (with appropriate backslashes --for some reason this posting system doesn't display them??). You can tell whether you have succeeded by opening a Command Prompt (a fresh one opened AFTER editing the path) and typing "javac" from the prompt. If it fails, you will see "'javac' is not recognized as an internal or external command" etc., and you should check your editing of the path carefully. If it has succeeded, you will see a long "Usage" statement for javac. An interesting nuisance: if there is a space after the semi-colon and before the C: of the new path item, it doesn't work. Took me a while to guess that that might be a problem..

I've also done everything listed and it is not working for me. I don't even have a javac file.

PLEASE HELP!!!

I fix the problem dont forget to restart the system after updatining the environnement variable

Thank you Frank. Had the same problem and that fixed it for me.

HI

      I have tried the same as above .

javac & jarsigner is working perfect in command prompt.may i know the right solution to solve this problem([ERROR] Error locating JDK: set $JAVA_HOME or put javac and jarsigner on your $PATH)

— answered 3 years ago by siva sankar
answer permalink
3 Comments
  • This post helped me. - 1.JAVA_HOME should NOT include the bin directory. 2. Add ;%JAVA_HOME%\bin into your PATH environment variable.

    — commented 1 year ago by Daniel Miller

  • WTF!!!!!

    — commented 12 months ago by scott newman

  • I tried all this and same error over and over???? PATH is ;%JAVA_HOME%\bin and JAVA_HOME is C:\Progra~2\Java\jdk1.6.0 and did the "blah blah -clean" and same error.... How did this App get a good rating when it won't work on windows that most corps use???????

    — commented 12 months ago by scott newman

Your Answer

Think you can help? Login to answer this question!