Error compiling PhoneGap

0

When executing the command to compile the phonegap

phonegap build android

But it has an error:

[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 is 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?

    
asked by anonymous 28.01.2016 / 08:13

1 answer

1

Good morning, my dear,

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

Ideally, remove OpenJDK and install Oracle JDK instead

below the command remove OpenJDK , enter the terminal as root

sudo apt-get remove --purge openjdk-*

NOTE: These are two strokes 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 in 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 automatically download and install Oracle Java!

Certainly you will no longer have the mentioned problem! Hail!

    
28.01.2016 / 12:37