Error when compiling Phonegap

Asked

Viewed 102 times

0

When running the command to compile phonegap

phonegap build android

But you make a mistake:

[phonegap] executing 'cordova build android'...
Running command: /var/www/gabriel/phonegap/teste/platforms/android/cordova/build 

[Error: Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.]

ERROR building one of the platforms: Error: /var/www/gabriel/phonegap/teste/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project

Error: /var/www/gabriel/phonegap/teste/platforms/android/cordova/build: Command failed with exit code 2

Java ta installed normal: ( java -version )

java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.15.04.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

What can it be ?

1 answer

1


Good morning my dear,

the problem is with the type of JAVA installed on your machine OpenJDK

the ideal is to remove the OpenJDK and install the Oracle JDK in place

below the command removes the OpenJDK, enter the terminal as root

sudo apt-get remove --purge openjdk-*

OBS: are two traces before purge.

Now let’s add the PPA to download and install Oracle Java (JDK), then you can choose whether to install version 7 or 8. Still on the terminal, type one line at a time:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo mkdir -p /usr/lib/mozilla/plugins

If you want to install Java version 7 run:

sudo apt-get install oracle-java7-installer

If you want to install Java version 8 run:

sudo apt-get install oracle-java8-installer

This process will download and install Oracle Java automatically!

Surely you will no longer have the problem mentioned! Health!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.