简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM