我试图用cmake建立一个项目。这个项目正在使用Java等。问题是在代码处
find_package(Java REQUIRED)
我收到以下错误:
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)
虽然
which java
输出
/usr/bin/java
怎么会?该错误的原因是什么?
如果您使用的是Linux操作系统,则必须将Java home设置为export
JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35 export PATH=$JAVA_HOME/bin:$PATH