java-module

Java 9 migration javax.annotation

血红的双手。 提交于 2019-12-07 14:45:38
问题 So i try to migrate my project to Java 9 but the process seems not so easy as i thought it would be. I kept getting some errors about invisible packages that i could fix with the following argument in my pom: <compilerArgs> <arg>--add-modules</arg> <arg>java.se.ee</arg> </compilerArgs> But i still get the following error: cannot find symbol [ERROR] symbol: class Priority [ERROR] location: package javax.annotation any help would be appreciated 回答1: I'm not sure where javax.annotation.Priority

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

橙三吉。 提交于 2019-12-07 05:12:35
问题 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? 回答1: 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,

How to export all packages from Java 9 module? [duplicate]

会有一股神秘感。 提交于 2019-12-06 19:49:47
问题 This question already has an answer here : Why is exporting the entire module not allowed? (1 answer) Closed 2 years ago . Right now, for every module I have, I need to explicitly specify packages I want to export. For example: module core { exports cc.blynk.server.core; exports cc.blynk.server.core.protocol.handlers.decoders; exports cc.blynk.server.core.protocol.handlers.encoders; } However, it is not very convenient. I would like to do something like that: module core { exports cc.blynk

Can one Java module export a package whose name is a subpackage of a package from another module? [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-06 11:10:33
This question already has an answer here : Java 9 sub-packages split across modules (1 answer) Closed 10 months ago . So I know that, in Java 9 modules (Project Jigsaw), split packages are not allowed. That is, the following modules couldn't both export a package with the same name and also be used at the same time at run time: Module 1 module com.example.foo { exports com.example.foo; } Module 2 module com.example.foo { exports com.example.foo; } Not allowed (or, at least, they can't run at the same time). But what isn't clear to me is how subpackages come in to play. If one module exports

What else am I missing to load service providers using the new Java module system?

青春壹個敷衍的年華 提交于 2019-12-06 02:14:51
I'm adding module-info.java s to Ikonli packages and I'm running into trouble with their service classes. ikonli-core defines an interface called IkonHandler . ikonli-fontawesome5-pack has a service provider for the IkonHandler called FontAwesomeSolidIkonHandler . These service prodivers are used by ikonli-javafx 's IkonResolver . Given this, I created these module definitions: module org.kordamp.ikonli.core { exports org.kordamp.ikonli; } module org.kordamp.ikonli.javafx { exports org.kordamp.ikonli.javafx; uses org.kordamp.ikonli.IkonHandler; requires javafx.graphics; requires org.kordamp

Best approach to dynamically load modules (classes) in Java

不问归期 提交于 2019-12-06 00:54:45
问题 I'm currently writing an application that requires to operate on different type of devices. My approach would be to make a "modular" application that can dynamically load different classes according to the device they need to operate on. To make the application easily extensible, my goal is to assign a specific path to the additional modules (either .jar or .class files) leaving the core program as it is. This would be crucial when having different customers requiring different modules

Java 9 migration javax.annotation

穿精又带淫゛_ 提交于 2019-12-05 22:47:04
So i try to migrate my project to Java 9 but the process seems not so easy as i thought it would be. I kept getting some errors about invisible packages that i could fix with the following argument in my pom: <compilerArgs> <arg>--add-modules</arg> <arg>java.se.ee</arg> </compilerArgs> But i still get the following error: cannot find symbol [ERROR] symbol: class Priority [ERROR] location: package javax.annotation any help would be appreciated I'm not sure where javax.annotation.Priority comes from, but a solution analog to getting JSR 305 running on Java 9 should fix your problem: Instead of

Java9 JNLP --add-opens not working

六眼飞鱼酱① 提交于 2019-12-05 18:37:13
问题 I have created a simple test case to test Java 9 Web Start with the new modules. Unfortunately, Java 9 Web Start does not by default support --permit-illegal-access like regular Java 9 does. Java 9 Web Start is suppose to support --add-opens (see https://bugs.openjdk.java.net/browse/JDK-8172986). I'm using Java 1.9.0_181_ea. Here is my test class: import java.awt.Toolkit; import java.lang.reflect.Method; import java.lang.IllegalAccessException; import java.lang.reflect

java 9 unnamed module reads package [X] from both … while debugging (with IntelliJ)

旧街凉风 提交于 2019-12-05 15:27:25
In my project I have a package that uses several 3rd party libraries. Let's have a look at the dependency tree: [INFO] +- commons-logging:commons-logging:jar:1.2:compile [INFO] +- org.apache.directory.studio:org.apache.commons.collections:jar:3.2.1:compile [INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile [INFO] +- xerces:xercesImpl:jar:2.11.0:compile [INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile [INFO] +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.2.2:compile [INFO] | +- org.apache.cxf:cxf-core:jar:3.2.2:compile [INFO] | | +- com.fasterxml.woodstox:woodstox-core:jar:5.0

Java 9 migration issue - package com.mymodule is declared in unnamed module , module 'newmodule' does not read it

限于喜欢 提交于 2019-12-05 15:17:06
I have created a multimodule project with the following structure myproject |- mymodule |- src |- main |- java |- com |- mymodule |- Util.java |-newmodule |-src |-main |-java |-com |-newmodule |- Main.java |-module-info.java Now i want to use Util.java which is a non modularized code in a modularized module newmodule. i have declared following in newmodule module newmodule { requires mymodule; } Project is compiling fine, but Intellij is showing module not found and package com.mymodule is declared in unnamed module , module 'newmodule' does not read it. How to resolve this issue? And one more