java-9

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

Package is not visible error

喜你入骨 提交于 2020-04-29 09:20:21
问题 I was trying to use joptsimple package in my project but I get following error: Error:(4, 20) java: package jdk.internal.joptsimple is not visible (package jdk.internal.joptsimple is declared in module jdk.internal.opt, which does not export it to the unnamed module) Any ideas what should I do with it? 回答1: Well, the message clearly reads (in fact notice the beautiful naming convention by JDK devs " internal " meaning they don't want to expose them) that the API you're trying to access is in

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

Java 9 ifPresentOrElse returning value

痞子三分冷 提交于 2020-04-07 07:11:00
问题 1/ Working code: public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); studentOpt.isPresent() { return updateStudent(id, name); } else { return createStudent(id, name); } 2/ I try to change it to 'full lambdas code' (not working): public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); return studentOpt.ifPresentOrElse(student-> return updateStudent(id, name), () -> return createStudent(id, name)); } 1/ should I change it

Java 9 ifPresentOrElse returning value

99封情书 提交于 2020-04-07 07:09:05
问题 1/ Working code: public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); studentOpt.isPresent() { return updateStudent(id, name); } else { return createStudent(id, name); } 2/ I try to change it to 'full lambdas code' (not working): public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); return studentOpt.ifPresentOrElse(student-> return updateStudent(id, name), () -> return createStudent(id, name)); } 1/ should I change it

Java 9 ifPresentOrElse returning value

我只是一个虾纸丫 提交于 2020-04-07 07:06:40
问题 1/ Working code: public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); studentOpt.isPresent() { return updateStudent(id, name); } else { return createStudent(id, name); } 2/ I try to change it to 'full lambdas code' (not working): public Student process (int id, name){ Optional<Student> studentOpt = myrepo.findById(id); return studentOpt.ifPresentOrElse(student-> return updateStudent(id, name), () -> return createStudent(id, name)); } 1/ should I change it

Set resolution manually in Java Swing

安稳与你 提交于 2020-02-02 15:58:20
问题 I need a way to manually control/stretch the size of my whole GUI. I have a 1400 x 1050 Desktop (native resolution) and I want to scale the resolution manually to 1024 x 1050 inside the code, because my application was written on/for a 1024 x 768 Desktop. So in general the whole frame and all buttons etc should be stretched / bigger as a whole and the relation should stay the same. I can´t do it via Windows properties because the resolution in general needs to be 1400 x 1050 because of

Inclusive takeWhile() for Streams

大憨熊 提交于 2020-02-02 15:44:46
问题 I want to know if there is a way to add the last element of the stream that was tested against the condition of the method takeWhile(). I believe I want to achieve something similar to RxJava's takeUntil() method. I'm guessing there is no direct way to do this (correct me if I am mistaken), but I would like to know if there is a proper workaround to achieve this that I am now aware of. I've searched throughout Stackoverflow with little to no success. If you think there are threads that could

Android SDK manager throw Exception with Java 9 [duplicate]

点点圈 提交于 2020-01-31 06:15:53
问题 This question already has answers here : Failed to run sdkmanager --list with Java 9 (16 answers) Closed 2 years ago . Using sdk-tools-darwin-4333796 (26.1.1) with Java 9 when running sdkmanager is throwing : Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75) at com.android.sdklib

Android SDK manager throw Exception with Java 9 [duplicate]

假如想象 提交于 2020-01-31 06:15:16
问题 This question already has answers here : Failed to run sdkmanager --list with Java 9 (16 answers) Closed 2 years ago . Using sdk-tools-darwin-4333796 (26.1.1) with Java 9 when running sdkmanager is throwing : Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75) at com.android.sdklib