java-module

Patching java.base results in java.lang.LinkageError

北慕城南 提交于 2019-12-05 12:44: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 modifications displayed (a simple print out I did from valueOf ). When I try, however, to do the same

Why open a non-existing package from a Java module?

二次信任 提交于 2019-12-05 09:40:13
The JLS 11 "7.7.2. Exported and Opened Packages" says: It is permitted for opens to specify a package which is not declared by a compilation unit associated with the current module. What would be a scenario for this? Why is this needed? Thanks to Alan Bateman and Michael Easter for explanations, and I can think of some realistic scenarios. First, as was explained by Alan and Michael: JLS allows to "open" directories without Java types for situations when we keep resources in them. So, for us these are "resource directories", but JLS names it as package which is not declared by a compilation

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

牧云@^-^@ 提交于 2019-12-05 09:25:44
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? Looks like you've created a split package , meaning two modules ( module-a and module-b in your case) contain the same package ( some.package ). The module system does not allow that. If you place both modules on the module

Gradle for Java 11 with Modules

我们两清 提交于 2019-12-05 09:03:46
I'm trying to run a sample JavaFX app on Mac OS. build.gradle apply plugin: 'java' apply plugin: 'application' repositories { mavenCentral() } dependencies { compile "org.openjfx:javafx-base:11" compile "org.openjfx:javafx-graphics:11" compile "org.openjfx:javafx-controls:11" } compileJava { doFirst { println "CLASSPATH IS $classpath.asPath" options.compilerArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.graphics' ] classpath = files() } } Java class package com.test; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label;

Java Beans Introspector requires desktop module

北城以北 提交于 2019-12-05 07:16:44
I'm investigating using Jigsaw to reduce the footprint of a microservice. One of the last dependencies I had to find was java.beans.Introspector. Imagine my surprise when I discovered I needed to bring in the whole module java.desktop which contains all sorts of irrelevant stuff like awt, applets, swing etc. This seems crazy to me, surely bean introspection should be a part of the fundamental language and not related to UI functionality. I think the dependency comes from the embedded Tomcat from Spring Boot so it's not something I can modify myself. The Question: Are modules the finest

Java 9 modules and classpath hell: conflicting class names

て烟熏妆下的殇ゞ 提交于 2019-12-05 05:16:50
It is said that java 9 modules will solve classpath hell. However, I am thinking about the following situation: Module A uses modules B and C. Both modules will export a class with same name and package. How will the classloading issue be solved here? This situation is forbidden in the Java 9 module system. If two modules in the same layer have the same package, Java 9 will fail at startup with an error: java.lang.LayerInstantiationException: Package <package_name> in both module <moduleB_name> and module <moduleC_name> 来源: https://stackoverflow.com/questions/44086361/java-9-modules-and

Illegal reflective access in an applet with Jaxb and JDK 9

雨燕双飞 提交于 2019-12-05 05:08:39
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 stops working. I have narrowed it down to this code fragment (where Foo is an auto-generated class

Groovy Java 9 modules support

一个人想着一个人 提交于 2019-12-05 00:22:58
I've spent some time to migrate my project written in Groovy to Java 10. Now it's possible to compile and run it. But still it doesn't use any benefits of Java 9 modularity. Googling about Groovy and Java 9 modules gives almost nothing. So is it possible to migrate Groovy project to use JDK 10 with Project Jigsaw modules? Well, after a few days of experiments I come up with the answer - yes, it is possible to use Groovy with Project Jigsaw modules. But it needs some additional effort. Let's say we have following file structure: ├── build ├── jigsaw │ └── module │ └── test │ └── Application

When JRE was completely discontinued as a separate offering?

寵の児 提交于 2019-12-04 23:49:23
问题 Starting from Java 9 the module system was introduced, making provision of JRE separately redundant . Through, it seems that it was still possible to download it. For example, from here now Java 9 archive Also, here it's only stated that : Restructure the JDK and JRE run-time images to draw a clear distinction between files that developers, deployers, and end-users can rely upon and, when appropriate, modify, in contrast to files that are internal to the implementation and subject to change

Java 9 error: not in a module on the module source path

跟風遠走 提交于 2019-12-04 13:41:32
问题 Project structure I have a project written in Java 8 and I want to update it to Java 9. So I separated the classes into 2 separate modules. Modules: org.ggp.base with module-info.java in the directory org.ggp.base/src/main/java . Its build was automated with Gradle before I started the update to Java 9. The module uses an abstract class implementation included in pl.edu.prz.klopusz module. pl.edu.prz.klopusz in the directory pl.edu.prz.klopusz/dolar-app/src/main/java . I want to automate its