td icon indicating copy to clipboard operation
td copied to clipboard

Java Example Problem

Open gianlocc opened this issue 6 years ago • 8 comments

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?

gianlocc avatar Jun 30 '20 19:06 gianlocc

Could you show output of all invoked commands?

levlam avatar Jun 30 '20 20:06 levlam

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!

gianlocc avatar Jul 01 '20 15:07 gianlocc

What is output of cmake --version?

levlam avatar Jul 01 '20 15:07 levlam

cmake version 3.16.3

gianlocc avatar Jul 01 '20 15:07 gianlocc

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.

gianlocc avatar Jul 01 '20 15:07 gianlocc

@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.

levlam avatar Jul 01 '20 15:07 levlam

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.

ars3niy avatar Jul 01 '20 18:07 ars3niy

Explicit Java version specification was removed in master, so this is probably workarounded now.

levlam avatar Aug 29 '20 10:08 levlam