java-module

Unable to export a package from java.base module

给你一囗甜甜゛ 提交于 2019-11-30 05:14:46
Using IDEA-EAP for JDK9 development experiments. I am getting the following error - Error:(3, 20) java: package jdk.internal.misc is not visible (package jdk.internal.misc is declared in module java.base, which does not export it to module com.jigsaw.npe) The class definition is as - package experiment; import jdk.internal.misc.Unsafe; public class CompareAndSwap { static Unsafe UNSAFE = Unsafe.getUnsafe(); ... } I've tried including a module-info.java file as well inside the module created using the IDE with the following statements - module com.jigsaw.npe { requires java.base; } Directory

How does the Javadoc deal with the visibility of modules in Java 9?

ⅰ亾dé卋堺 提交于 2019-11-30 04:53:47
The Javadoc tool generates documentation based on the accessibility modifier. By default, it document all public and protected classes, fields and methods. This can be changed with the following options : -public Shows only public classes and members. -protected Shows only protected and public classes and members. This is the default. -package Shows only package, protected, and public classes and members. -private Shows all classes and members. Java 9 introduces the concept of modules, and project Jigsaw applies it to the existing JDK. A talk by Mark Reinhold (3rd in a series of talks about

Do Kotlin 1.2.10 and Java 9 have opposite rules regarding automatic modules?

百般思念 提交于 2019-11-30 04:03:42
问题 I have a Gradle project using the Kotlin Gradle plugin. I want to build a Java 9 module, so my directory structure looks like this: src/main/java/ - module-info.java src/main/kotlin/ - Foo.kt - Bar.kt build.gradle ... My build.gradle declares the following dependencies: dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.10" compile "org.jetbrains.kotlin:kotlin-reflect:1.2.10" compile "org.junit.jupiter:junit-jupiter-api:5.0.2" } and I use all of these dependencies in my

How to extract the file jre-9/lib/modules?

荒凉一梦 提交于 2019-11-30 02:01:42
In JRE-9/lib directory (at least on Windows), there is a new file called modules whose size is about 107 MB. Is it possible to extract that file or maybe list java modules within it? I can see that a new tool called jmod is available at jdk-9/bin/jmod.exe , but that is for reading .jmod files which is located at jdk-9/jmods and it cannot read the file modules . The modules file is a container file. It's internal to the JDK and the format is not documented (it may change at any time). For troubleshooting purposes, the jimage tool in the bin directory can be used to list or extract the contents.

Java 9 + maven + junit: does test code need module-info.java of its own and where to put it?

﹥>﹥吖頭↗ 提交于 2019-11-30 01:56:03
Let's say I have a Java project using Maven 3 and junit. There are src/main/java and src/test/java directories which contain main sources and test sources, respectively (everything is standard). Now I want to migrate the project to Java 9. src/main/java content represents Java 9 module; there is com/acme/project/module-info.java looking approximately like this: module com.acme.project { require module1; require module2; ... } What if test code needs module-info.java of its own? For example, to add a dependence on some module that is only needed for tests, not for production code. In such a

Can I require Java 9 module via MANIFEST.MF?

岁酱吖の 提交于 2019-11-29 17:59:40
问题 My Java library should be compatible with Java 8 and Java 9. For running with Java 9 we need some of the Java 9 modules. I know that I can add it via command line with --add-modules . But it is a library and I can't control the command line. Is there an equivalent of --add-modules in MANIFEST.MF ? Or is there any other solution that is compatible with Java 8? 回答1: Unfortunately, there is no equivalent of --add-modules in MANIFEST.MF . However, you can create module-info.java and declare your

findResource(“”) returning null when module-info.java is present, why is that?

廉价感情. 提交于 2019-11-29 16:35:11
问题 I'm debugging why in the presence of module-info.java in my Spring Boot application, spring-orm throws an exception during start up time. This is the exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction

Java 9: Possible to have 2 modules with same name on module path

会有一股神秘感。 提交于 2019-11-29 09:47:59
问题 Is it possible to have 2 modules with the exact same name (but with slightly different contents) on the module path? As far as I can tell, the Java 9 compiler does not complain about it. I have 2 modules declared as follows: module com.dj.helper { exports com.dj.helper; } Both contain the com.dj.helper package but within the package the contents are different. Then in my main application, I am looking to import this module: module com.dj { requires com.dj.helper; } Both modules with the same

Error occurred during initialization of boot layer FindException: Module not found

拜拜、爱过 提交于 2019-11-29 07:05:45
Executing a simple "Hello World" program using Java 9 results in the following error message: Error occurred during initialization of boot layer java.lang.module.FindException: Module com.pantech.myModule not found The command line that I executed was: java --module-path bin -m com.pantech.myModule/com.pantech.myModule.HelloWorld This command line is executed from the parent directory of my bin directory that contains all of the .class bytecode files. The module-info.class file is located in the com.pantech.myModule directory that is located in the bin directory. The HelloWorld.class file

Unable to export a package from java.base module

一笑奈何 提交于 2019-11-29 02:35:15
问题 Using IDEA-EAP for JDK9 development experiments. I am getting the following error - Error:(3, 20) java: package jdk.internal.misc is not visible (package jdk.internal.misc is declared in module java.base, which does not export it to module com.jigsaw.npe) The class definition is as - package experiment; import jdk.internal.misc.Unsafe; public class CompareAndSwap { static Unsafe UNSAFE = Unsafe.getUnsafe(); ... } I've tried including a module-info.java file as well inside the module created