java-module

How to get access to javax.annotation.Resource at run time in Java 9

妖精的绣舞 提交于 2019-11-26 23:19:11
问题 I have a test: public class ResourceTest { @Test public void test() throws ClassNotFoundException { Class.forName("javax.annotation.Resource"); } } It tries to access javax.annotation.Resource . In java 8 it worked, but in java 9 (I'm using Oracle JDK 9) it fails with ClassNotFoundException . As explained here Spring: @Resource injection stopped working under JDK9 , javax.annotation.Resource from the JDK is not available by default in Java 9. I'm trying to get access to it using module

what is an illegal reflective access

橙三吉。 提交于 2019-11-26 20:38:48
There are a lot of questions around about illegal reflective access in Java 9. Now what I can't find because all Google spews up is people trying to work around the error messages, is what an illegal reflective access actually is. So my question fairly simple is: What defines an illegal reflective access and what circumstances trigger the warning? I have gathered that it has something to do with the encapsulation principles that were introduced in Java 9, but how it all hangs together and what triggers the warning in what scenario I can't find an explanation to. Apart from an understanding of

JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState

被刻印的时光 ゝ 提交于 2019-11-26 20:22:48
I'm trying to run DMelt programs ( http://jwork.org/dmelt/ ) program using Java9 (JDK9), and it gives me errors such as: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.python.core.PySystemState (file:/dmelt/jehep/lib/jython/jython.jar) to method java.io.Console.encoding() WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState 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 How

Scanning classpath/modulepath in runtime in Java 9

一曲冷凌霜 提交于 2019-11-26 18:54:01
I can't seem to find any info on whether scanning all available classes (for interfaces, annotations etc) is still possible in runtime, the way Spring, Reflections and many other frameworks and libraries currently do, in the face of Jigsaw related changes to the way classes are loaded. EDIT : This question is about scanning the real physical file paths looking for classes. The other question is about dynamically loading classes and resources. It's related but very much not a duplicate . UPDATE : Jetty project has made a JEP proposal for a standardized API for this. If you have a way to help

java 9 module reads package X from A and B

五迷三道 提交于 2019-11-26 18:26:28
问题 I am trying to use spring boot with java 9 and gradle. I am unable to run my simple code, I get the below mentioned error :- Information:java: Errors occurred while compiling module 'Java9Gradle_main' Information:javac 9-ea was used to compile java sources Information:6/9/2017 10:40 PM - Compilation completed with 65 errors and 0 warnings in 15s 200ms Error:java: module reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging Error:java: module reads package org

List the modules resolved during the application startup

三世轮回 提交于 2019-11-26 17:57:55
How can one get to know of the list of modules that have been resolved while the application has been started so as to figure out what all service providers are accessible from the root module. Module Resolution The module resolution is a two-step process. The first step recursively enumerates the 'requires' directives of a set of root modules. If all the enumerated modules are observable, then the second step computes their readability graph. The readability graph embodies how modules depend on each other, which in turn controls access across module boundaries. One can make use of the

The jdk.incubator.httpclient module not found in Java11

若如初见. 提交于 2019-11-26 16:55:16
问题 Using the early access build for JDK/11 to compile an existing code based on Java-9 which was using a VM argument --add-modules jdk.incubator.httpclient to resolve the HTTP/2 client incubator module now ends up with a compilation error Module not found: jdk.incubator.httpclient Java version details :- java 11-ea 2018-09-25 Java(TM) SE Runtime Environment 18.9 (build 11-ea+11) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+11, mixed mode) 回答1: With the standardization of the HTTP Client

Where do resource files go in a Gradle project that builds a Java 9 module?

一曲冷凌霜 提交于 2019-11-26 16:44:14
问题 As of IDEA 2018.2.1, the IDE starts error-highlighting packages "not in the module graph" from dependencies that have been modularized. I added a module-info.java file to my project and added the requisite requires statements, but I'm now having trouble accessing resource files in my src/main/resources directory. (For a complete example, see this GitHub project.) When I used ./gradlew run or ./gradlew installDist + the resulting wrapper script, I was able to read resource files, but when I

Create Java runtime image on one platform for another using Jlink

随声附和 提交于 2019-11-26 16:08:12
问题 I created runtime image using jlink on my Linux machine. And I see linux folder under the include folder. Does it mean that I can use this runtime image only for Linux platform? If yes, are there any ways to create runtime images on one platform for another (e.g. on Linux for Windows and vice versa) 回答1: The include directory is for header files, such as jni.h , that are needed when compiling C/C++ code that uses JNI and other native interfaces. It's nothing to do with jlink . The jlink tool

Java 9: Module java.xml.bind is not accessible in Eclipse

旧巷老猫 提交于 2019-11-26 11:21:36
问题 I migrating a maven project in Java 8 to a Java 9 project without any build tool in Eclipse OxyGen 1a . So my module-info.java looks like this: But java.xml.bind is not accessible, although its in my module path: So what is wrong here? 回答1: When compiling an unnamed module, java.xml.bind is not accessible by default, but in a modular project (as in this question) failing to resolve reference to module java.xml.bind was a bug (see edit below) . To work around this until the bug is fixed, you