"JDK (Java Development Kit) not Installed" when using Visual Studio Code with Titanum

Viewed 1741

I've seen a few people having this exact error when using titanium extension in VS Code but I have yet to see a definitive solution. Any thoughts would be greatly appreciated.

When I click "Play" to try to run my "hello world" program I see this error: original error

[ERROR] JDK (Java Development Kit) not installed.
[ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.
[ERROR] The JDK is required for Titanium and must be manually downloaded and installed from http://appcelerator.com/jdk.

In environment variables I set java_home by selecting the appropriate folder:

java_home

and set the path to point to the bin directory

java_home path

if I echo java_home it looks right.

echo java_home

EDIT 5/19/2020

Current appc info

  Name                        = Microsoft Windows 10 Pro
  Version                     = 10.0.18362.  All Rights Reserved.
  Architecture                = 64bit
  # CPUs                      = 8
  Memory                      = 15.9GB

Node.js
  Node.js Version             = 12.16.3
  npm Version                 = 6.14.4

Appcelerator CLI
  Installer                   = 5.0.0
  Core Package                = 8.0.0

Titanium CLI
  CLI Version                 = 5.2.2
  node-appc Version           = 0.2.49

Titanium SDKs
  9.0.1.GA
    Version                   = 9.0.1
    Install Location          = C:\ProgramData\Titanium\mobilesdk\win32\9.0.1.GA
    Platforms                 = android
    git Hash                  = 466c007fd2
    git Timestamp             = 4/15/2020 21:37
    node-appc Version         = 0.3.4

Intel® Hardware Accelerated Execution Manager (HAXM)
  Installed                   = yes
  Memory Limit                = 0 BYTES

Java Development Kit
  Not found

Genymotion
  Path                        = not found
  Genymotion Executable       = not found
  Genymotion Player           = not found
  Home                        = not found

VirtualBox
  Executable                  = not found
  Version                     = unknown

Android SDK
  Android Executable          = not found
  ADB Executable              = not found
  SDK Path                    = not found

Android NDK
  NDK Path                    = not found
  NDK Version                 = not found

Android Platforms
  None

Android Add-Ons
  None

Android Emulators
  None

Genymotion Emulators
  None

Connected Android Devices
Samsung Galaxy S10 (preview)
  ID                          = 192.168.80.101:5555
  State                       = device
  SDK Version                 = 10 (android-29)
  ABIs                        = x86

Java Development Kit Issues
  ×  JDK (Java Development Kit) not installed.
     If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly
     set.
     The JDK is required for Titanium and must be manually downloaded and installed from
     http://appcelerator.com/jdk.

Android Issues
  ×  JDK (Java Development Kit) not found.
     If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly
     set.
     The JDK can be downloaded and installed from http://appcelerator.com/jdk.
2 Answers

I was finally able to get this kind of working. I don't know if any of these is the magic bullet but here is what I did.

  1. Deleted all java installations. Over time various programs had installed their own.
  2. Deleted all jdks.
  3. Deleted appcelerator and titanium plugin for vs code. Also deleted the corresponding module folder manually.
  4. Rebooted
  5. Installed java 8 as per the docs.
  6. Installed corresponding jdks for this version and titanium plugins.
  7. I set java_home in windows and java.home in appc.

This is where things got kind of interesting. It still wasn't working at this point. I kept messing around with java home and it still wasn't working. It seemed that it wanted reboots after these changes and that simply closing VS Code wasn't enough. After one reboot things changed - VS Code picked up that java.home and java home were not in sync (one had "bin" in the path) and the other did not. When running appc info I could see that all of the sudden more information was being returned that had not been previously.

So I removed "bin" from the path and all of the sudden it was working again (I think I rebooted again). I was now up and running in the emulator! For a while, anyway. I was then getting gradle java heap errors and when I set java options and rebooted and rebooted I lost jdk again. Anyway.... that's my story. #$%$%$#%$% titanium.

Related