java-9

Can Java 9 run on a 32-bit OS?

雨燕双飞 提交于 2019-12-17 15:32:35
问题 Seems there are no 32-bit download packages on Oracle's available download list. UPDATE Can download here: wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_windows-x86_bin.exe 回答1: Although the 32-bit binaries for JDK9 seem to be missing from Oracle's lousy, unencrypted download page, if (after clicking "Accept License Agreement") you copy the URL of the 64-bit binaries and change x64

Where should I put unit tests when migrating a Java 8 project to Jigsaw

天大地大妈咪最大 提交于 2019-12-17 11:45:07
问题 I am currently testing to migrate a Java 8 application to Java 9 / Jigsaw, using jdk-9+149. The project has been laid out in standard Maven directory layout, i.e. having src/main/java , src/test/java , etc. As soon as I add the module-info.java to src/main/java , maven-compiler-plugin fails throwing a NullPointerException. This is because it expects to find a module-info for the test directory, too. So, as far as I can see, the options are: keep test classes in a separate module, which means

Java 9, compatability issue with ClassLoader.getSystemClassLoader

血红的双手。 提交于 2019-12-17 09:51:36
问题 The following code adds jar file to the build path, it works fine with Java 8. However, it throws exception with Java 9, the exception is related to the cast to URLClassLoader. Any ideas how this can be solved? an optimal solution will edit it to work with both Java 8 & 9. private static int AddtoBuildPath(File f) { try { URI u = f.toURI(); URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class<URLClassLoader> urlClass = URLClassLoader.class; Method method

Is there a way to add maven dependencies while using the maven-jlink-plugin?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 06:51:42
问题 I'm using this Github project to get exposed to the new modular features in Java 9. I would like to add dependencies to the project and be able to build a native image. However, when I try to add a new dependency to the pom.xml, and add the requires statement to the module-info.java, I get a the following error from the maven-jlink-plugin: Error: module-info.class not found for joda.time module I'm trying to use this as a proof of concept that I can deploy images using the new linking phase,

Is Maven ready for JDK9?

五迷三道 提交于 2019-12-17 04:58:51
问题 Today I tried the latest jdk9 Build 113 and tried to compile my project with the latest Maven 3.3.9 These are the commands (found partially via twitter) export MVN_OPTS="-Dmaven.compiler.fork -Dmaven.compiler.executable=/somewhere/Downloads/jdk-9/bin/javac" export JAVA_HOME="/somewhere/Downloads/jdk-9" mvn clean install But I get this error ... in short: [WARNING] Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver java.lang.ExceptionInInitializerError at sun.reflect

How to solve InaccessibleObjectException (“Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}”) on Java 9?

巧了我就是萌 提交于 2019-12-17 04:17:41
问题 This exception occurs in a wide variety of scenarios when running an application on Java 9. Certain libraries and frameworks (Spring, Hibernate, JAXB) are particularly prone to it. Here's an example from Javassist: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang"

How to solve InaccessibleObjectException (“Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}”) on Java 9?

旧城冷巷雨未停 提交于 2019-12-17 04:17:04
问题 This exception occurs in a wide variety of scenarios when running an application on Java 9. Certain libraries and frameworks (Spring, Hibernate, JAXB) are particularly prone to it. Here's an example from Javassist: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang"

List the modules resolved during the application startup

你离开我真会死。 提交于 2019-12-17 04:07:12
问题 How can one get to know of the list of modules that have been resolved while the application has been started so as to figure out what all service providers are accessible from the root module. 回答1: Module Resolution The module resolution is a two-step process. The first step recursively enumerates the 'requires' directives of a set of root modules. If all the enumerated modules are observable, then the second step computes their readability graph. The readability graph embodies how modules

What is the replacement for javax.activation package in java 9?

半城伤御伤魂 提交于 2019-12-17 03:08:49
问题 Seems like javax.activation package is deprecated in Java 9. Oracle migration guide proposes to use --add-modules java.activation option during JVM start. However, I would like to avoid this and replace javax.activation package's classes, as it is deprecated and will be removed in future java versions. I suppose, there should be some kind of alternative for javax.activation . If there is any available, what is it? 回答1: JavaBeans Activation Framework (JAF) is possibly the alternative you are

I have stored all the jar file into specific folder. How to configure specific folder to Jshell classpath ? [duplicate]

旧城冷巷雨未停 提交于 2019-12-14 03:07:09
问题 This question already has answers here : In JShell, how to import classpath from a Maven project (3 answers) Closed last year . I have stored all the jar file into specific folder and I have added specific folder to Jshell classpath. I am unable to import packages in jshell after adding classpath. It is working fine If I have mentioned all the jar file name in classpath. I don't want to mentioned all the Jar file name in classpath because I have to add more than thousand number of jar files