dp_
dp_

Reputation: 75

cmake can't find java, but it's installed

I am trying to build a project with cmake. This project is using java among other things. The problem is that at the code

find_package(Java REQUIRED)

I receive the following error:

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message):

Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)

Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindJava.cmake:195 (find_package_handle_standard_args)
CMakeLists.txt:66 (find_package)

Though

which java

outputs

/usr/bin/java

How come? What can be the reason of this error?

Upvotes: 3

Views: 14336

Answers (1)

MGPJ
MGPJ

Reputation: 1072

If you are using the linux os then you have to set the java home like export

JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35   
export PATH=$JAVA_HOME/bin:$PATH

Upvotes: 6

Related Questions