java-module

Error occurred during initialization of boot layer

江枫思渺然 提交于 2020-05-14 19:43:29
问题 I followed the steps to create the HelloWorld example but it doesn't run. It gives the following error: Error occurred during initialization of boot layer java.lang.module.FindException: Error reading module: F:\Develop\eclipse\HelloWorld\bin Caused by: java.lang.module.InvalidModuleDescriptorException: HelloWorld.class found in top-level directory (unnamed package not allowed in module)" Please advise how to solve this. 回答1: The error occurs because of you add your jar library files to

Does --add-opens work for dynamically created layers in JPMS?

本秂侑毒 提交于 2020-04-30 11:05:08
问题 I have a JPMS framework that dynamically creates JPMS layers and add modules to them. After some tests it seems to me that --add-opens JVM parameter works only for the boot layer , I mean the layer that is created when application starts. So, the question - does --add-opens work for dynamically created layers in JPMS? Concrete example --add-opens java.base/java.lang=weld.servlet.shaded will java.base/java.lang be opened to weld.servlet.shaded if weld.servlet.shaded is in dynamically created

Use third party artifacts with split packages in Maven and Java 9

╄→гoц情女王★ 提交于 2020-04-11 06:30:31
问题 I am trying to make my project ready for Java 9 and I am running into problems with split packages (artifacts sharing the same package). My application depends on at least two third-party legacy artifacts (that are built with Java <9). When I run Maven with Java 9, I get: [ERROR] module myapp reads package P from both A and B Which is correct, since the package P exists in A.jar and B.jar, but without overlapping classes. I understand that this is a problem for Java 9 and I studied suggested

JPMS: --add-opens doesn't work for java.lang.reflect.InaccessibleObjectException

不想你离开。 提交于 2020-04-11 05:44:56
问题 I use Java 14 with Jetty 9.4 and Weld-servlet-shaded-3.1 and I get this exception: Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to module weld.servlet.shaded. According to answer here: https://stackoverflow.com/a/41265267/5057736 I tried to add --add-opens java.base/java.lang=ALL

How to add spark dependencies in spring-boot multi module Java 11 project

♀尐吖头ヾ 提交于 2020-01-25 05:43:05
问题 Whenever I am adding a module-info.java in my multi-module project I cannot import my spark dependencies - everything else seems to be working <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-core_2.12</artifactId> <version>3.0.0-preview2</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-sql_2.12</artifactId> <version>3.0.0-preview2</version> </dependency> IntelliJ tries to readd Maven Dependency without any result. My module-info

Cannot access JavaFX class “WebPage” in IntelliJ-IDEA

廉价感情. 提交于 2020-01-14 04:53:07
问题 I've been using JavaFX-11 for a while. I set JavaFX as a Global library in my Project structure. I also added all the modules inside as required in the module-info.class file of my project. This is working fine, but now I need a Class, "WebPage", that's inside the javafx.web module. Specifically, it's inside javafx.web.com.sun.webkit.WebPage. However, my IDE, Intellij-IDEA doesn't access it. When I type the whole path the tooltip says that, Package 'com.sun.webkit' is declared in javafx.web,

How can I set the ModuleMainClass attribute of a JPMS module using Gradle?

烈酒焚心 提交于 2020-01-13 19:11:32
问题 I'm using Gradle (6.0.1) with the moduleplugin to build an application out of JPMS modules using JDK 13. However, even with the application plugin applied & its mainClassName set it does not set the ModuleMainClass attribute in module-info.class , so when I jlink it up into a standalone JVM and run java -m mymodule I get this message: module mymodule does not have a ModuleMainClass attribute, use -m <module>/<main-class> Digging under the hood it looks like the moduleplugin doesn't change the

Patching java.base results in java.lang.LinkageError

流过昼夜 提交于 2020-01-13 11:09:09
问题 I am trying to do the same thing in Java 11 that could be done with -Xbootclasspath/p:path in pre java 9. As a simple example I modified one of the valueOf methods of java.lang.Integer and compiled the project with: javac --module-source-path=src/java.base --patch-module java.base=src/java.base -d mods $(find src -name '*.java') I then ran a simple sample using: java --patch-module java.base=<pathToMyModifiedJavaBaseClasses> -p lib -m my.moduleA/my.moduleA.Main That worked an I'm seeing the

what is an illegal reflective access

孤者浪人 提交于 2020-01-08 11:38:41
问题 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 is an illegal reflective access

拥有回忆 提交于 2020-01-08 11:37:42
问题 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