appcelerator titanium JAVA_HOME not detected - java

When I am testing java -version , javac -version im getting a proper version in the cmd output ., but when I run the app from appcelerator I'm getting this below error., JAVA_HOME has been set properly .
[ERROR] Application Installer abnormal process termination. Process exit value was 1
[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.

Most of all, if you get proper outout for java -version or javac -version it doesn't mean JAVA_HOME environment variable had already set. If your PATH environment variable contains java / javaw / javac binaries, you can run it but JAVA_HOME hadn't set. You should check it with: echo %JAVA_HOME%
Other thing is, Appcelerator requires JDK (Java Development Kit). JRE is not enough. But it seems you have JDK, because javac is not part of JRE edition.
At last look for yourself the right version of JDK and Appcelerator you have downloaded. E.g. both of those are for 64-bit operating systems.
Related issues:
[1] https://jira.appcelerator.org/browse/AC-6020
[2] https://github.com/appcelerator/atom-appcelerator-titanium/issues/129

Related

JDK/JRE installation for Windows

I am attempting to install JDK 13 with the accompanying JRE.
I set these environment variables:
JAVA_HOME to C:\Program Files\Java\jdk-13.0.2
JRE_HOME to JAVA_HOME\bin
as per online instructions.
But when I try:
java Greetings
I get an error message that reads like: "JRE incompatible with with JDK 13 compiler".
java -version says "java version 1.8.0_241"
The Java Control Panel lists:
Product: 1.8.0_241 Path: C:\Program Files\Java\jre1.8.0_241\bin\javaw.exe
Product: 13.0.2 Path: C:\Program Files\Java\jdk-13.0.2\bin\javaw.exe
I can delete the entry for 13.0.2 but not the entry for 1.8.0_241
What am I missing?
The JAVA_HOME variable is used by many programs (e.g. Eclipse IDE and the Maven build processor) to find the Java Runtime.
However, the CMD shell searches executables by the PATH variable. You need to add the path to java.exe to the PATH variable as well. Also ensure that you do not have multiple Java versions in the PATH because the first one will be executed.
Please note that all environment variables can be configued for all users system-wide and also for each account personally. This causes confusion sometimes.

How to know the jdk version on my machine?

I have recently uninstalled JDK 11 and installed JDK 8. For confirmation, I want to check which JDK is installed on my Windows 10 machine. I typed java -version on cmd then get the error message
java is not recognized as an internal or external command
How to know which JDK version installed on my PC?
you might need to add path in environment variables which you can find in Control Panel
open the Jdk where you installed and add until /bin in the path in environment variables.
Add until /bin in path variable in System Variables which is residing in Environment Variables.
Then do
java -version
which might show up.
If still problem persists, try restarting your pc and see.
You need to update your Windows path to include your %JAVA_HOME%\bin directory. %JAVA_HOME% is the directory that you installed Java into and is also an environment variable that you need to configure for command line execution of your applications. You can edit both of these in the Windows control panel and you should restart.
When you run java -version you will see the internal version number. This is explained here: https://en.wikipedia.org/wiki/Java_version_history.
Basically, you can ignore the 1. when reading version number. The _xxx is a reference to the most recent patch or build release.
On Windows 10, this required mapping the environment variable for JAVA_HOME to the JDK installation directory. Use these steps:
Run the installer for the JDK. (available for windows here: https://www.oracle.com/java/technologies/downloads/#jdk17-windows)
windows key -> Environment Variables, select the only result
In the System Properties window that opened, select Environment Variables
Select new button under the User variables section
Variable name: JAVA_HOME, Variable Value: <The JDK filepath from step 0>
ok all open menus
Close any open cmd prompt windows
open a new cmd window and type echo %JAVA_HOME% It should print the installation path for the JDK.
To get your jdk location in Windows, run this at a command prompt:
where java
This lists any and all locations of java.exe, including from your JAVA_HOME. For example, the 3rd line here reflects my JAVA_HOME location, where I'm pointing to JDK 8:
C:\Users\me> where java
C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk1.8.0_202\bin\java.exe
Note for comparison that java -version does not reflect my JAVA_HOME location and in fact shows java version 11 instead of 8:
C:\Users\me> java -version
java version "11.0.15" 2022-04-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15+8-LTS-149)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15+8-LTS-149, mixed mode)
This is confusing because my Java compiles (e.g., via mvn) use JDK 8 since that's what my JAVA_HOME is pointing to. (I'm not even sure where the version 11 it found came from; possibly from when I installed maven.)
Determining the difference between the JRE and JDK you're running has never been straightforward. Seems like java -version used to be a way to do this, but no longer.
Adding to the complexity, you can also supposedly get your Java version info from Control Panel > Programs > Java > About. For me, that shows Version 8. That's despite java -version showing version 11.0.15. And it doesn't change even if I point my JAVA_HOME to JDK 11.
Note that this answer is also helpful. In my case, that helped me determine that I have java.exe and javac.exe at C:\Program Files (x86)\Common Files\Oracle\Java\javapath and C:\Program Files\Common Files\Oracle\Java\javapath. Depending on which one I have listed first in my Path variable, I get different results when i run java -version or java --version. The former seems to work when Java 8 is listed first; the latter when Java 11 is first.

Error when building Ionic APP using Cordova

(node:16112) UnhandledPromiseRejectionWarning: CordovaError: Failed to run "javac -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files (x86)\Java\jre1.8.0_171
I checked my user environment variable and I have the variable JAVA_HOME and set to "C:\Program Files (x86)\Java\jre1.8.0_171"
I also have C:\Program Files (x86)\Java\jre1.8.0_171 appended to the user environment variable PATH.
make sure you have a JDK installed
This is the relevant part of this error message. Your JAVA_HOME points to a Java Runtime Environment (JRE), not to a Java Development Kit (JDK).
javac is the Java compilation command, which Cordova is attempting to execute in this case. However, javac is not shipped with the JRE as it is a development tool.
You need to download and install a JDK and set JAVA_HOME to point to it

javac NotRecognized - Java version 1.8.0_161 |

I'm testing out some code on a computer running Windows 8.1.
I'm using the command prompt and I can't seem to get javac (or javaC) to compile my text file. I've added the path as an environment variable (...\bin) and it doesn't do work. java -version and java prints information to the console, just can't get javac to work.
Seems like you are having JRE installed on your machine. You can go to your JAVA_HOME/bin folder, check if javac file is there or not. If not, it means you have JRE installed. You need to install java JDK.
FOr download jdk, this is the url for JDK 8:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Previous version available here:
http://www.oracle.com/technetwork/java/archive-139210.html

Ant and Classpath

I just started to learn Java using Thinking in Java book, and have some troubles using ant.
I'm using Ubuntu 12.04, and have openjdk 7 java installed. I also setup the CLASSPATH to be the code folder
When I run ant in code folder, this is the output:
Exception in thread "main" java.lang.RuntimeException: JDK 1.4.1 or higher is required to run the examples in this book.
[CheckVersion] at com.bruceeckel.tools.CheckVersion.main(Unknown Source)
However when I run java -version, this is the output:
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
How to setup ant and classpath correctly?
P/S: Thanks everyone for the help!!! I figured out why it fails to check the version.
The testing condition is "if(minor < '4' || point < '1')" in CheckVersion.java. Yet my version is 1.6.024, eventhough 6>4 but 0<1 that's why it failed. I guess we need to rewrite the testing condition!
Try setting your JAVA_HOME environment variable to the install directory of your 1.6 JDK.
When you type "java -version", the command shell is using the first java executable it finds in your PATH. Ant probably looks for the java executable in the "bin" sub-directory of your JAVA_HOME directory.
To find the location of your java executable, type the following:
which java
and let's say you got the following output:
/usr/local/java1.6/bin/java
You would then set your JAVA_HOME variable to /usr/local/java1.6. Assuming a Bourne or Bash shell, the syntax for that would be
export JAVA_HOME=/usr/local/java1.6

Categories