java-9

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

倖福魔咒の 提交于 2019-12-22 07:59:13
问题 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

Can't compile a java 9 project in IntelliJ IDEA with module-info

我与影子孤独终老i 提交于 2019-12-22 07:04:32
问题 Can't compile a java 9 project in IntelliJ IDEA with module-info. Create a project Add module Create a class with with a main (without module-info.java it runs) Add Module-info.java Run Main Fails Configuration Module-info module httpexample { } Error Error:(1, 1) java: file should be on source path, or on patch path for module Intellij Version IntelliJ IDEA 2017.1.2 Build #IU-171.4249.39, built on April 25, 2017 JRE: 1.8.0_112-release-736-b16 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains

How do I include a java 9 module at runtime?

我是研究僧i 提交于 2019-12-22 07:02:47
问题 I have a server kit that I'm trying to test on the java9 JDK (found here, I'm using the 64-bit Linux version), however I'm encountering the following error shortly after startup: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:533) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186

Java Beans Introspector requires desktop module

巧了我就是萌 提交于 2019-12-22 05:33:10
问题 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

RuntimeException: Package jdk.internal.jimage.decompressor in module jrt.fs and module java.base

此生再无相见时 提交于 2019-12-22 05:29:17
问题 Component Details - Using IntelliJ IDEA 2017.1 CE and jdk-9-ea+154 main() - Set<String> set2 = Set.of("a", "b", "c"); set2.forEach(System.out::println); module-info.java module collection { requires java.base; } Logs - Error occurred during initialization of VM java.lang.RuntimeException: Package jdk.internal.jimage.decompressor in both module jrt.fs and module java.base at jdk.internal.module.ModuleBootstrap.fail(java.base@9-ea/ModuleBootstrap.java:699) at jdk.internal.module.ModuleBootstrap

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

How to use sun.reflect package in jdk9/java-9?

╄→尐↘猪︶ㄣ 提交于 2019-12-22 04:56:20
问题 I am using jdk-9 and I want to use sun.reflect.* package in my code but I am getting the below exception Exception in thread 'main' java.lang.IllegalAccessError : class Test (in moudle: Unnamed Module) cannot access class sun.reflect.Reflaction (in module:java.base), sun.reflect is not exported to Unnamed module when I run below sample code using JDK-9 public static void main(String args[]){ System.out.println(Reflection.getCallerClass(3)); } 回答1: These sun.* packages were never part of the

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

How do I run a class compiled with jaotc?

梦想的初衷 提交于 2019-12-22 04:32:37
问题 I compiled a simple class using the Java 9 Ahead-Of-Time Compiler jaotc using the following command: javac Test.java jaotc Test.class This produces a file named unnammed.so . How do I run the compiled program? Do I need to write a bootstrap program to link with the .so file? 回答1: After executing an AOT compilation, you need to specify generated AOT library during application execution: java -XX:AOTLibrary=./Test.so Test You should also compile java.base to gain real improvement, performance

Is it possible to disable modules in Java 9? [closed]

↘锁芯ラ 提交于 2019-12-22 04:00:52
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . I use OSGI and this is the main reason that I want to disable modules, as I really don't need another module framework. Is it possible to do it, for example using command line option? If yes, then how? 回答1: There is no option to turn off the module system - it will always be active. This impacts