java-module

Modules A and B export package some.package to module C in Java 9

旧时模样 提交于 2019-12-22 05:29:15
问题 I have three modules module-a, module-b and module-c. When I run my application I get the following: Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules module-a and module-b export package some.package to module module-c What does it mean, taking into consideration that module-c doesn't import some.package and how to fix it? 回答1: Looks like you've created a split package, meaning two modules ( module-a and module-b in your case) contain the same

Illegal reflective access in an applet with Jaxb and JDK 9

半城伤御伤魂 提交于 2019-12-22 04:42:56
问题 I have a Java applet which provides a GUI to invoke a web service. It uses Jaxb to parse the XML data and unmarshall it into objects. It runs correctly with Java 1.5 to 1.8. With Java 9, not so much. I use a container HTML to launch it in Internet Explorer 8 + JDK 9: <applet code="com.blah.MyApplet" archive="myFatJarWithDependencies.jar" mayscript> <param name="cache_option" value="no" /> </applet> The applet loads fine and seems to work; however, once I connect to the web service, it kind of

Create Module in JShell in Java 9

安稳与你 提交于 2019-12-21 10:17:25
问题 Just exploring new release of Java, its new module system, and playing with jshell as well. Probably my question doesn't have too much sense, but I am just curious. So I came up with the question: Is there any way to create a module in jshell? Or module can be only created in module-info.java ? 回答1: Modules cannot be created using JShell currently and it is not a Goal of JShell either. JShell Functionality The JShell API will provide all of JShell's evaluation functionality. The code

How to add “requires” for artifact having “-”(hyphen) in its name

寵の児 提交于 2019-12-21 07:08:20
问题 I've included these dependencies in my Maven pom.xml: <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> I am trying to add this dependency in module-info.java like so: module io.github.wildcraft.restclient { requires httpcore; // no compilation problem requires httpclient; // no

java 9: JLink created invalid images - missing module executable script

会有一股神秘感。 提交于 2019-12-21 04:42:22
问题 I am creating a sample application with 3 modules user , dept and account . In my user module, I have a main class and compile my modules with the following command: javac -d target --module-source-path src $(find -name "*.java") After compiling, execute following command for run: java -p target -m com.user/com.user.info.Launcher The output after running java modules are successful. But when trying to create runtime image using jlink the image created successfully but module executable script

Java 9 overlapping non-exported packages

独自空忆成欢 提交于 2019-12-21 02:04:15
问题 Various resources (infoq, jigsaw-dev, osdir) indicate that having the same package in different java modules will lead to a LayerInstantiationException , even when the packages are internal to the module (non-exported). This seems to be the exact opposite of what the requirements say : The Java compiler, virtual machine, and run-time system must ensure that modules that contain packages of the same name do not interfere with each other. If two distinct modules contain packages of the same

How to make Multi-Release JAR Files with Gradle?

旧城冷巷雨未停 提交于 2019-12-20 17:42:04
问题 Java9 introduces with Multi-Release JARs. Let's say that I have multimodule Gradle project using java8: project-root settings.gradle build.gradle /module1 /src ... (common maven structure) /module2 /module3 This is a common multi-module project in Gradle. Let's say I need MR-Jar for module1 . I can't add module1-java9 targeting Java9 because the base is on 8 - so far, both my Gradle and IntelliJ IDEA complains. Gradle is compiled with the java8, but I need to enable java9 runtime just for the

cannot compile Java 9 module with --patch-module in IntelliJ IDEA 2017.2.1

扶醉桌前 提交于 2019-12-20 17:27:00
问题 I am trying to acquaint myself with Java 9 modules and how to define them in IntelliJ. Among other things, I want to solve a split package problem using the --patch-module compiler/JVM flag and I don't know how to make it work in IntelliJ. I am using IntelliJ IDEA 2017.2.1 Build #IC 172.3544.35 with Java HotSpot(TM) 64-Bit Server VM (build 9+180, mixed mode). This is my source file MyImmutableList.java : package com.google.common.collect; public class MyImmutableList extends

cannot compile Java 9 module with --patch-module in IntelliJ IDEA 2017.2.1

巧了我就是萌 提交于 2019-12-20 17:26:32
问题 I am trying to acquaint myself with Java 9 modules and how to define them in IntelliJ. Among other things, I want to solve a split package problem using the --patch-module compiler/JVM flag and I don't know how to make it work in IntelliJ. I am using IntelliJ IDEA 2017.2.1 Build #IC 172.3544.35 with Java HotSpot(TM) 64-Bit Server VM (build 9+180, mixed mode). This is my source file MyImmutableList.java : package com.google.common.collect; public class MyImmutableList extends

Compile a JDK 8 project + a JDK 9 “module-info.java” in Gradle

此生再无相见时 提交于 2019-12-19 10:18:54
问题 I'm working on a Java library targeting JDK 8, and I'm building it in Gradle 5 using OpenJDK 11. In order to target JDK 8, I'm javac's --release option. However, I'd also like my library to be JPMS-compatible. In other words: I'd like to provide a module-info.class compiled with --release 9 (option 3 in Stephen Colebourne's scale), while all the rest is compiled with --release 8 . MCVE build.gradle : plugins { id 'java' id 'org.javamodularity.moduleplugin' version '1.4.1' // * } repositories