java-9

fatal error compiling invalid flag --module-path

柔情痞子 提交于 2019-12-09 15:54:29
问题 I have a project. Originally it was a single module project with structure like this java-cloud-sample\ src\ main\ java pom.xml I decided to make it into a multi-module structure - I use java 9 anyway. So I separated it like this java-cloud-sample\ java-cloud-rest-api\ src\ pom.xml pom.xml Where root pom.xml looks like this <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/

Which module should I require in Java 9 to use JPA?

余生长醉 提交于 2019-12-09 11:31:11
问题 I'm testing Java 9 with a project which requires JPA ( javax.persistence.* classes). When I add the module-info.java and declare my module, all classes under javax.persistece package become unavailable. I searched a lot, but I couldn't find the module to require to use JPA in a Java 9 module project. UPDATE As Alan suggested, I ran $ jar --describe-module --file=javax.persistence-api-2.2.jar No module descriptor found. Derived automatic module. java.persistence@2.2 automatic requires java

Limit modules added by javapackager

人走茶凉 提交于 2019-12-09 10:37:17
问题 I am trying to reduce the size of my application by limiting the modules that it includes. I already did this for my runtime using jlink . However, when I run javapackager using the --add-modules and --limit-modules options with a comma-separated list of the same small set of modules I used for the runtime, it insists on adding all of the modules anyway. It doesn't seem to want to honor the option I'm giving it. How can I get the tool to limit the modules it adds to my app bundle? "Adding

Scala incompatibility with Java 9 - java.lang.NoClassDefFoundError

偶尔善良 提交于 2019-12-09 06:44:53
问题 Just run a sample Scala SBT project after installing Java 9 on my pc and I took this exception. I already tried some solutions that I found but nothing. Is there any incompatibility between Java 9 and Scala? Scala Version: 2.12.3 Java Version: java version "9" IDE: IntelliJ Thanks in advance. info] Compiling 7 Scala sources and 1 Java source to /Users/ermis/Projects/begining-scala/target/scala-2.12/classes... [info] p.a.h.EnabledFilters - Enabled Filters (see <https://www.playframework.com

What Jersey version do I need to download for JDK 1.9?

陌路散爱 提交于 2019-12-09 06:12:18
问题 I am using jdk 1.9. I am trying to bring up a simple ReST service. Created the project using the maven archetype: jersey-quickstart-webapp . Then I went ahead and modified the pom.xml and web.xml. My maven config is as shown below: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>restWebService<

Why is exporting the entire module not allowed?

你说的曾经没有我的故事 提交于 2019-12-09 02:27:06
问题 In Java 9's module declaration there are 2 constructs: exports com.foo; And opens com.foo; Where exports grants compile-time access, while opens allows runtime access, as reflection and resources. opens has one leniency over exports that you can define the whole module as open, resulting the same as explicitly opening every package: open module com.mod { But there's no similar construct exported module com.mod { My Question : Why is it so; what decisions has been made to allow opening the

Why am I getting an IllegalArgumentException when creating a Map?

て烟熏妆下的殇ゞ 提交于 2019-12-08 17:51:55
问题 I'm trying to create a map of cities and temperature, but it's throwing an IllegalArgumentException . Here's what I'm doing: Map<String, Integer> tempMap = Map.of("London", 13, "Paris", 17, "Amsterdam", 13, "Madrid", 21, "Rome", 19, "London", 13, "Bonn", 14, "Moscow", 7, "Barcelona", 20, "Berlin", 15); If I add them one by one there's no problem: Map<String, Integer> tempMap = new Hashmap<>(); // or LinkedHashMap tempMap.put("London", 13); tempMap.put("Madrid", 21); tempMap.put("Moscow", 7);

How to clear Java 9 JShell Console?

℡╲_俬逩灬. 提交于 2019-12-08 14:56:17
问题 I didn't find any command to clear Java-9 JShell console. I also tried to clear the JShell Console through this program, but it doesn't work either. import java.io.IOException; class CLS { public static void main(String... arg) throws IOException, InterruptedException { new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor(); } } I think we don't have that functionality available yet in the early access. Anyone got an idea? 回答1: You can use the following command (reference):

How to get a Module by its name in Java 9?

强颜欢笑 提交于 2019-12-08 11:48:13
问题 How to get java.lang.Module by string name in Java 9? For example, we have String name = "some.module"; Module module = //how to get here it? 回答1: One way to get your module from the boot layer which consists at least java.base after its initialization is: String moduleName = "my.module"; Module m = ModuleLayer.boot().findModule(moduleName).orElse(null); though preferably a safe way IMO, would be to get a module would be using the Configuration and the system ClassLoader to get the

How to upgrade javax.naming.* and javax.xml.* imports to be compatible with java 10

安稳与你 提交于 2019-12-08 10:12:16
问题 I have a java project built with maven and jdk 1.8. Some classes use javax.naming.* and javax.xml.* classes in the jdk. From Java 9 onwards those javax packages have been removed from the jdk. So how do I upgrade the project to run on java 9 or later? Here are the classes, import javax.naming.Binding; import javax.naming.Context; import javax.naming.Name; import javax.naming.NameClassPair; import javax.naming.NameParser; import javax.naming.NamingEnumeration; import javax.naming