ElektraInitiative / libelektra

Elektra serves as a universal and secure framework to access configuration settings in a global, hierarchical key database.
https://www.libelektra.org
BSD 3-Clause "New" or "Revised" License
207 stars 123 forks source link

java not correctly detected #1649

Closed markus2330 closed 6 years ago

markus2330 commented 6 years ago

Describe what you wanted to do

Compile Elektra with:

scripts/configure-debian
make -j 5

java is installed, but not javac.

Describe what you expected

That binding is excluded, because javac is missing, like jni already does:

-- Could NOT find JNI (missing:  JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Exclude Plugin jni because jni not found

Describe what actually happened

-- Include Binding jna
...
[ERROR] COMPILATION ERROR : 
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (default-compile) on project libelektra4j: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Workaround: ~e/scripts/configure-debian -DBINDINGS="ALL;-jna" ~e or install java-sdk.

System Information

markus2330 commented 6 years ago

Another Java related issue when compiled with Java 9:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
e1528532 commented 6 years ago

Another Java related issue when compiled with Java 9

That seems to be related to maven, as our bindings don't use the guice library. On OSX i have maven 3.5.2 which doesn't show this issue, on ubuntu i have maven 3.5.0 which shows the issue, so i guess this got fixed already. Anyway its just a warning for now, and out of our scope to fix. Once Java10 gets released we can require a minimum maven version if old maven versions are still common.

java not correctly detected

fixed in #1530

markus2330 commented 6 years ago

Works perfectly now. Without javac (with java) you get:

-- Could NOT find JNI (missing:  JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Exclude Plugin jni because jni not found
-- Could NOT find Java (missing:  Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) (found version "1.8.0.141")
-- Exclude Binding jna because javac (java compiler) not found, which is only included in a jdk