java-10

Java 10 Eclipse + Maven “java.lang.module.FindException: Module myproject not found”

为君一笑 提交于 2021-02-19 06:27:04
问题 I have created a new Java 10 project in Eclipse 4.7.3a This is a maven project with some dependencies. The project is called "MyProject" and below is my module-info.java module myproject { exports myproject; requires commons.logging; requires htmlunit; requires htmlunit.cssparser; requires java.logging; requires java.xml; requires selenium.api; requires selenium.firefox.driver; requires selenium.remote.driver; } when I run the project I get the following Error occurred during initialization

Gradle using 2 different JDK

三世轮回 提交于 2021-02-07 22:02:01
问题 I would like use some features from Java 9 and 10 in my PC java application which has common code with android app. When I use jdk 10 or jdk 9 android application is building, but it doesn't launch(it is throwing a lots of errors). When I use jdk 8 for whole project everything is working correctly without any error. When I manually build project using 2 different jdk everything is working fine. I tried set targetCompability and sourceCompability for android application for JavaVersion.Version

Gradle using 2 different JDK

我们两清 提交于 2021-02-07 22:01:40
问题 I would like use some features from Java 9 and 10 in my PC java application which has common code with android app. When I use jdk 10 or jdk 9 android application is building, but it doesn't launch(it is throwing a lots of errors). When I use jdk 8 for whole project everything is working correctly without any error. When I manually build project using 2 different jdk everything is working fine. I tried set targetCompability and sourceCompability for android application for JavaVersion.Version

Java 10 ifPresentOrElse that return boolean

我与影子孤独终老i 提交于 2021-02-07 19:54:09
问题 I am a little confused on "how to do this properly": // return true: if present and number of lines != 0 boolean isValid(Optional<File> optFile) { return optFile.ifPresentOrElse(f -> return !isZeroLine(f), return false); } private boolean isZeroLine(File f) { return MyFileUtils.getNbLinesByFile(f) == 0; } I know the syntax is not correct and not compiling, but it's just for you to get the idea. How can I turn this into 'clean code'? i.e. avoid doing: if (optFile.isPresent()) {//} else {//}

Java 10 ifPresentOrElse that return boolean

a 夏天 提交于 2021-02-07 19:53:12
问题 I am a little confused on "how to do this properly": // return true: if present and number of lines != 0 boolean isValid(Optional<File> optFile) { return optFile.ifPresentOrElse(f -> return !isZeroLine(f), return false); } private boolean isZeroLine(File f) { return MyFileUtils.getNbLinesByFile(f) == 0; } I know the syntax is not correct and not compiling, but it's just for you to get the idea. How can I turn this into 'clean code'? i.e. avoid doing: if (optFile.isPresent()) {//} else {//}

java.lang.ClassNotFoundException sun.misc.GC

被刻印的时光 ゝ 提交于 2021-02-04 17:07:56
问题 Version Java: 10.0.1 Tomcat: 8.0.36 Ubuntu: 18.04 (64 bit) Eclipse: Photon (64 bit) Error: When I run the Tomcat server, I found below error. Please don't tell me to decrease the version if possible, because I love to use latest technology. SEVERE: Failed to trigger creation of the GC Daemon thread during Tomcat start to prevent possible memory leaks. This is expected on non-Sun JVMs. java.lang.ClassNotFoundException: sun.misc.GC at java.base/java.net.URLClassLoader.findClass(URLClassLoader

java.lang.ClassNotFoundException sun.misc.GC

我只是一个虾纸丫 提交于 2021-02-04 17:07:08
问题 Version Java: 10.0.1 Tomcat: 8.0.36 Ubuntu: 18.04 (64 bit) Eclipse: Photon (64 bit) Error: When I run the Tomcat server, I found below error. Please don't tell me to decrease the version if possible, because I love to use latest technology. SEVERE: Failed to trigger creation of the GC Daemon thread during Tomcat start to prevent possible memory leaks. This is expected on non-Sun JVMs. java.lang.ClassNotFoundException: sun.misc.GC at java.base/java.net.URLClassLoader.findClass(URLClassLoader

Getting “Error on input: java.io.IOException: Resource temporarily unavailable” when pressing Tab in jshell

半腔热情 提交于 2021-01-28 05:30:55
问题 So I was fiddling some code in jshell, but it started crashing when I pressed Tab. int[] a = new int[]{1, 2, 5, 0, -1} In my next statement, when I type A-r-r-a, then (Tab) to autocomplete to Array and get options, it crashes with Error on input: java.io.IOException: Resource temporarily unavailable Does anyone know how to fix this? EDIT: I'm using Elementary OS Juno. It is a distro based on Ubuntu 18.04 回答1: I believe this may be a result of https://bugs.launchpad.net/ubuntu/+source/linux/

Illegal reflective access when I stop SpringBoot web application with Tomcat 9 and Java10

点点圈 提交于 2021-01-26 21:36:01
问题 I'm trying Java 10 development with Spring Boot 2 and I encounter some issues. The application is a simple webapp based upon Spring Boot 2. The application launch is ok but when I stop it, I get this warning: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/C:/Users/CS/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.11/tomcat-embed-core-9.0.11.jar) to field java.io