Due to this issue, at the moment Cordova isn't able to run on Java 9 (please correct me if I'm wrong).
A similar question was discussed here, but the proposed solutions involve the removal of Java 9, or the reset of the JAVA_HOME environment variable to point to Java 8, but both has the side effect that all the other Java applications will run on Java 8.
So how do you set Cordova to use Java 8, having the rest of applications still on Java 9?
解决方案
... the reset of the JAVA_HOME environment variable to point to Java 8, but [that] has the side effect that all the other Java applications will run on Java 8.
Only if you do it the wrong way!
Create a file (say mycordova.sh) containing this, make it executable and put it on your shell's command search path.
#!/bin/sh
export JAVA_HOME=/path/to/java8/home
cordova "$@"
Running that command runs cordova using Java 8 without interfering with other applications.
UPDATE - If the work-around proposed is to use alternatives to change, that means that the cordova launcher / script, is not using JAVA_HOME to find the java command. You can deal with that too. There are a couple of possibilities:
If cordova is a wrapper script, then copy it and edit it to use the version of the java command (etc) that you want to use.
If not then in your mycordova.sh script (see above) also update the PATH variable so that the Java 8 JRE's bin directory is ahead of the directory containing the java link that alternatives manages. That will work ... provided that the standard cordova launcher has not hard wired /usr/bin/java
UPDATE 2 - Final script for mycordova.sh is:
#!/bin/sh
export JAVA_HOME=/path/to/java8/home
export PATH=/path/to/java8/bin/:$PATH
cordova "$@"