java-9

final variables are not functioning well in jshell

与世无争的帅哥 提交于 2019-12-18 05:01:02
问题 I am working with jshell of JDK9. I just created a final variable and assigned a value to it. And in the next line i just modified the value. And to my surprise, there was no error when modifying the final variables. Here is the code snippets: jshell> final int r = 0; | Warning: | Modifier 'final' not permitted in top-level declarations, ignored | final int r = 0; | ^---^ r ==> 0 jshell> r = 1; r ==> 1 jshell> System.out.println("r = "+r) r = 1 Is it what is expected from jshell? or there is

Does Java 9 include Graal?

不羁的心 提交于 2019-12-17 23:17:32
问题 I'm reading JEP 317. It says that Graal (a new experimental Java-based JIT compiler) will be part of JDK 10, but then it says that is already available in JDK 9. So, what's the point of JEP 317 then? Does Java 9 include Graal or not? 回答1: From one of my memos, on linux-x64 (out-of-the-box) to use Graal on JDK 9, you can enable it using : -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler Source : Tweet from Chris. If you're explicitly willing to make use of the org

Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1

删除回忆录丶 提交于 2019-12-17 21:55:44
问题 My JDK 9+181 Spring Boot 2.0.0.BUILD-SNAPSHOT CLI application displays this warning on startup: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/jan/src/fm-cli/target/fm-cli-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.0.0.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting

Missing dependencies when generate-module-info jdeps

℡╲_俬逩灬. 提交于 2019-12-17 20:17:35
问题 I`m trying to run jdeps with the following command: jdeps --module-path modules --generate-module-info out com.demo.market.jar My com.demo.market.jar depends both on application modules and automatic modules. I put all dependencies in the 'modules' folder but I got an error: Error: missing dependencies com.demo.market.platform.MarketPlace -> com.demo.client.wholesale.Client not found com.demo.market.platform.MarketPlace -> com.demo.product.api.Product not found com.demo.market.platform

“package java.net.http does not exist” error on JDK9

て烟熏妆下的殇ゞ 提交于 2019-12-17 19:15:11
问题 I have a problem compiling simple blocking GET example from the HttpRequest JavaDoc: package org.example; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import static java.net.http.HttpRequest.noBody; import static java.net.http.HttpResponse.asString; public class Http2 { public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException { HttpResponse

creating module-info for automatic modules with jdeps in java 9

北慕城南 提交于 2019-12-17 17:59:11
问题 I have 3 jar of jackson library jackson-core-2.8.10.jar jackson-annotations-2.8.0.jar jackson-databind-2.8.10.jar I created module-info.java for both core and annotation successfully and converted them to Named maodule using jdeps. for databind , I tried following command: jdeps --generate-module-info . --module-path %JAVA_HOME%\jomds;jackson.core;jackson.annotations existingmods\jackson-databind-2.8.10.jar Now following error is occuring : Missing dependence: .\jackson.databind\module-info

What's the difference between requires and requires transitive statements in Java 9?

て烟熏妆下的殇ゞ 提交于 2019-12-17 17:38:28
问题 What's the difference between requires and requires transitive module statements in module declaration? For example: module foo { requires java.base; requires transitive java.compiler; } 回答1: Readability recap If module bar requires module drink , then the module system... enforces the presence of drink (called reliable configuration ) allows bar to read drink (called readability) allows code in bar to access public classes in exported packages in drink (called accessibility) Exactly the same

Hibernate 5 issue with JDK 9

拈花ヽ惹草 提交于 2019-12-17 16:52:31
问题 I have a Hibernate 5 project that perfectly builds and runs on Java 8. I tried to test it on JDK 9 ea build 171. Since it is a huge project and have other dependencies I had to add java.xml.bind module to the JVM configuration for tests: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.20</version> <configuration> <argLine>--add-modules java.xml.bind</argLine> </configuration> </plugin> There were other issues that I could resolve

Choosing JRE runtime environment in java 9 in eclipse oxygen version

我的梦境 提交于 2019-12-17 16:31:53
问题 I am trying to explore Java 9 features with Eclipse Oxygen Version. I have downloaded the java 9 and Eclipse Oxygen version. But when I try to create a new java project Java SE 1.9 is not available in the list of JRE Execution environment. How to proceed further? Any help would be appreciated. Choosing Runtime environment Choosing default JRE?? 回答1: How to proceed further? Any help would be appreciated. Try to make use of the option Use default JRE . Though this seems to be not configured on

In JShell, how to import classpath from a Maven project

核能气质少年 提交于 2019-12-17 15:51:39
问题 I have a local Maven project under development. How can I launch jshell with the project class path with all the dependencies, so that I can test project or dependency classes inside JShell. 回答1: You can use the jshell-maven-plugin: mvn com.github.johnpoth:jshell-maven-plugin:1.1:run which will fire up a JShell session with your project's runtime path. If you want to include your test dependencies just add -DtestClasspath to the command. Source code: https://github.com/johnpoth/jshell-maven