java-11

jlink packages current platform's binaries

泪湿孤枕 提交于 2021-02-19 03:58:07
问题 I am trying to build cross-platform archives of an application built using Java 11 and packaged with jlink . For the cross-platform packaging I am basing my build on this answer. I have managed to make my Gradle build download the target platform's JDK and invoke jlink with the appropriate jmods folder, however the target image always includes the binaries and JRE structure of the host platform (in my case Windows, meaning the generated bin folder always includes DLLs and Windows executables)

ForkJoinPool performance Java 8 vs 11

故事扮演 提交于 2021-02-19 03:25:28
问题 Consider the following piece of code: package com.sarvagya; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; import java.util.stream.Collectors; public class Streamer { private static final int LOOP_COUNT = 2000; public static void main(String[] args){ try{ for(int i = 0; i < LOOP_COUNT; ++i){ poolRunner(); System.out.println("done loop " + i); try{ Thread.sleep(50L); } catch (Exception e){ System.out

Compile Module that Depends on an External Jar

给你一囗甜甜゛ 提交于 2021-02-19 01:49:28
问题 I worked through a simple example using Project Jigsaw in Java 11.0.1, built using the oracle JDK 11 on Ubuntu 18.04. Following that example, I have created a simple project which compiles to a module, packages the module into a jar, and then uses jlink to create a standalone distribution. Everything works -- the end result is a smallish folder with a stripped down JRE and my module. The project is made of only three files and some folders: .: build.sh src ./src: com module-info.java ./src

What's the meaning of “CGC” and “CGCT” in JDK11 “jstat -gc <PID>”?

若如初见. 提交于 2021-02-19 01:33:13
问题 There are two items called CGC and CGCT. I cannot found the documention and man page describing their meaning. # jstat -gc 139934 S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT 0.0 15360.0 0.0 15360.0 113664.0 9216.0 88064.0 23552.0 82304.0 80084.2 10112.0 9360.4 10 0.157 0 0.000 6 0.018 0.175 # java -version openjdk version "11.0.2" 2019-01-15 LTS OpenJDK Runtime Environment Corretto-11.0.2.9.3 (build 11.0.2+9-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.2.9.3

How should javac 11 link methods overridden in later versions with a Java 8 target?

被刻印的时光 ゝ 提交于 2021-02-18 11:36:33
问题 Let's say I'm using Java 11 javac, but I'm using the --source and --target options set to 1.8 so that my source code will be considered Java 8 and the output .class files will be compatible with Java 8. My goal is to produce .class files that can run on a Java 8 JVM. And let's say I have the following Java 8 code I'm compiling: import java.nio.ByteBuffer; … ByteBuffer byteBuffer = …; //init somehow byteBuffer.flip(); //what ends up in the `.class` file? The question is: what should Java 11

Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'

拥有回忆 提交于 2021-02-18 06:06:45
问题 In module-info.java i get the error Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'. Not only does the migration (Java 8 to Java 11) frustrate me slowly but surely, this error does not make any sense to me. The dependencies part fo my build.gradle : def springFrameworkVersion = '5.1.2.RELEASE' def hibernateVersion = '5.3.7.Final' def junitJupiterVersion = '5.3.1' dependencies { compile 'org.transentials:cardhouse-commons:1.1.1' compile 'ch.qos

Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'

馋奶兔 提交于 2021-02-18 06:05:01
问题 In module-info.java i get the error Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'. Not only does the migration (Java 8 to Java 11) frustrate me slowly but surely, this error does not make any sense to me. The dependencies part fo my build.gradle : def springFrameworkVersion = '5.1.2.RELEASE' def hibernateVersion = '5.3.7.Final' def junitJupiterVersion = '5.3.1' dependencies { compile 'org.transentials:cardhouse-commons:1.1.1' compile 'ch.qos

IntStream leads to array elements being wrongly set to 0 (JVM Bug, Java 11)

爷,独闯天下 提交于 2021-02-18 03:52:32
问题 In the class P below, the method test seems to return identically false : import java.util.function.IntPredicate; import java.util.stream.IntStream; public class P implements IntPredicate { private final static int SIZE = 33; @Override public boolean test(int seed) { int[] state = new int[SIZE]; state[0] = seed; for (int i = 1; i < SIZE; i++) { state[i] = state[i - 1]; } return seed != state[SIZE - 1]; } public static void main(String[] args) { long count = IntStream.range(0, 0x0010_0000)

ClassNotFoundException in JDBC program despite of adding driver's JAR file [duplicate]

蹲街弑〆低调 提交于 2021-02-16 14:20:51
问题 This question already has answers here : Connect Java to a MySQL database (14 answers) Closed 10 days ago . I am writing a simple program in Java using to demonstrate insertion of data in MySQL table using JDBC. But the program is generating ClassNotFoundException while registering driver. import java.sql.*; public class test { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e) { System.out.println("ClassNotFoundException:

micronaut-data : multiple data sources

谁说我不能喝 提交于 2021-02-11 15:31:44
问题 I have multiple databases in yml, how to get country specific repository? i am getting country name at runtime and based on country name i need to do operation with that country database, with single database it taking default database repository from yml. as per micronaut document : In multiple datasource scenario, the @io.micronaut.data.annotation.Repository annotation can be used to specify the datsource configuration to use. By default Micronaut Data will look for the default datasource.