[OpenJDK] tns platform add android: Error executing command 'javac'.
Following the tutorial, step 1-3:
~/hack/nativescript/sample-Groceries$ tns platform add android
Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.
~/hack/nativescript/sample-Groceries$ echo $JAVA_HOME
/usr/lib64/jvm/java
~/hack/nativescript/sample-Groceries$ javac
Usage: javac <options> <source files>
where possible options include:
@<filename> Read options and filenames from file
-Akey[=value] Options to pass to annotation processors
--add-modules <module>(,<module>)*
Root modules to resolve in addition to the initial modules, or all modules
on the module path if <module> is ALL-MODULE-PATH.
--boot-class-path <path>, -bootclasspath <path>
Override location of bootstrap class files
--class-path <path>, -classpath <path>, -cp <path>
Specify where to find user class files and annotation processors
-d <directory> Specify where to place generated class files
-deprecation
Output source locations where deprecated APIs are used
-encoding <encoding> Specify character encoding used by source files
-endorseddirs <dirs> Override location of endorsed standards path
-extdirs <dirs> Override location of installed extensions
-g Generate all debugging info
-g:{[lines, vars, source],[lines, vars, source],[lines, vars, source]}
Generate only some debugging info
-g:none Generate no debugging info
-h <directory>
Specify where to place generated native header files
--help, -help Print a synopsis of standard options
-implicit:{[none, class],[none, class]}
Specify whether or not to generate class files for implicitly referenced files
-J<flag> Pass <flag> directly to the runtime system
--limit-modules <module>(,<module>)*
Limit the universe of observable modules
--module <module-name>, -m <module-name>
Compile only the specified module, check timestamps
--module-path <path>, -p <path>
Specify where to find application modules
--module-source-path <module-source-path>
Specify where to find input source files for multiple modules
-nowarn Generate no warnings
-parameters
Generate metadata for reflection on method parameters
-proc:{[none, only],[none, only]}
Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]
Names of the annotation processors to run; bypasses default discovery process
--processor-module-path <path>
Specify a module path where to find annotation processors
--processor-path <path>, -processorpath <path>
Specify where to find annotation processors
-profile <profile>
Check that API used is available in the specified profile
--release <release>
Compile for a specific VM version. Supported targets: 6, 7, 8, 9
-s <directory> Specify where to place generated source files
-source <release>
Provide source compatibility with specified release
--source-path <path>, -sourcepath <path>
Specify where to find input source files
--system <jdk>|none Override location of system modules
-target <release> Generate class files for specific VM version
--upgrade-module-path <path>
Override location of upgradeable modules
-verbose Output messages about what the compiler is doing
-version Version information
-Werror Terminate compilation if warnings occur
-X Print a synopsis of nonstandard options
The message from the tns platform command is useless because it does not say what the error is.
Have you exported the $JAVA_HOME? It must be visible to the child process.
The variable is already set at an earlier time. Of course it will be part of the environment of child processes spawned from the shell:
$ echo $JAVA_HOME
/usr/lib64/jvm/java
$ perl -E'say $ENV{JAVA_HOME}'
/usr/lib64/jvm/java
$ node -p process.env.JAVA_HOME
/usr/lib64/jvm/java
Why is this tagged as question? I am not asking a question, I am reporting a bug. Why do you close the ticket before it's resolved? Kindly reopen.
↑ @PanayotCankov ↑
Having the same issue here. Everything is configured as it should be, but I keep getting the error, no matter which tns command I try.
@daxim My problem when away after setting the OpenJDK v8.
sudo update-alternatives --config java
sudo update-alternatives --config javac
I have the same problem. Any solution?
Hey guys, sorry for the late reaction. Do you still have this issue? @alextfos @kristoftorfs @daxim
@cdarken ☝️
is this safe to ignore? since android studio works fine for me despite this warning. message what that error was when executing javac would be nice
Hi @aep
Can you elaborate a bit more on is this safe to ignore?
Do you see some errors now, what are the steps to reproduce them?
Closing due to inactivity.
yep, still getting the message, but everything works fine.
$ javac -version
javac 1.8.0_141
@dtopuzov openjdk. i dont use ubuntu. so no. also i cant really reproduce this anymore, after a system update, sorry. maybe it's already fixed in the meantime?
Thanks, for the info, it looks like we have this issue only with OpenJDK (we recommend Oracle's JDK).
I'm having the same problem. I'm using Oracle's JDK, JAVA_HOME is in the PATH, android studios works OK and also the emulator.
But tns run android do not work, it say:
"Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable."
Please, fix this
I have the same problem I use javac in my terminal fine but the script say "Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable." when "Verifying CocoaPods. This may take some time, please be patient.."
+1
same issue here on a mac
ok I've been dealing with this since yesterday and the issue finally went away.
I had jdk-9 and jdk-8 so I removed both using the commands in this stackoverflow thread https://stackoverflow.com/questions/19039752/removing-java-8-jdk-from-mac
Then reinstalled jdk-8u144-macosx-x64.dmg after restarting. Once that was done, I ran tns doctor but it complained about android sdks so I added the ANDROID_HOME variable path again. After that, I ran tns doctor one more time and the javac error went away.
Hopefully this helps someone.