Java Example Problem
Hi, when i finish the build with cmake i have to run
cd <path to TDLib sources>/example/java/bin
but when i go into the java folder there isn't a bin folder; i need to go to td/bin folder but if i run the (corrected) command java '-Djava.library.path=.' ../../org/drinkless/tdlib/example/Example return a lots of error (dependencies not resolved).
Am I doing something wrong or the example isn't working?
Could you show output of all invoked commands?
Sure, checking the log i found this error
Make Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Java (missing: Java_JAVADOC_EXECUTABLE) (found suitable
version "14.0.1", minimum required is "1.6")
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindJava.cmake:338 (find_package_handle_standard_args)
CMakeLists.txt:18 (find_package)
-- Configuring incomplete, errors occurred!
What is output of cmake --version?
cmake version 3.16.3
Sure, checking the log i found this error
Make Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Java (missing: Java_JAVADOC_EXECUTABLE) (found suitable version "14.0.1", minimum required is "1.6") Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.16/Modules/FindJava.cmake:338 (find_package_handle_standard_args) CMakeLists.txt:18 (find_package) -- Configuring incomplete, errors occurred!
Resolved installing the default-jdk. I installed the JDK14 from the oracle site, maybe this version was not shipped with the javadoc program.
@Gianlo98 It is likely that JDK 14 is not supported by CMake 16 yet, but it is odd that it needs special support from cmake.
I think the problem can be that this line
find_package(Java 1.6 REQUIRED)
from example/java/CMakeLists.txt will only work with JDK that has version number 1.x, and fail with newer JDK that use different version numbering.
UPD: As such, it is possible that at some point a more recent cmake will (if it hasn't already) fix its FindJava function to deal with this.
Explicit Java version specification was removed in master, so this is probably workarounded now.