java-11

Java 11 application as lightweight docker image

时光怂恿深爱的人放手 提交于 2019-11-28 14:37:03
问题 Inspired by question Why is the Java 11 base Docker image so large? (openjdk:11-jre-slim) I found that this topic in Java world is still not settled. As for 07 Dec 2018 there are common issues/pitfalls (discussed in the ticket above): JRE is not distributed as a separate "package". Modules from JDK should be used instead Oracle OpenJDK 11 doesn't support Linux Alpine, so lightweight images can't be easily created In the same time current stable Debian versions still doesn't have Java 11

How to keep connection alive in Java 11 http client

二次信任 提交于 2019-11-28 05:26:56
问题 I'm using the Java 11 HttpClient with HTTP/2 and need to keep connection alive for few minutes, but the builder does not have the option to set it. Is there a way to specify this and make client keep the connection alive for some time? 回答1: If you build a standard HttpClient e.g. using HttpClient.newHttpClient(); by default a connection pool is created. This pool keeps the connections alive by default for 1200 seconds (20 minutes). If you want to change the keep-alive timeout you can do so

How to customise “host” header in Java http client

寵の児 提交于 2019-11-28 03:48:17
问题 Here's my code: HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://127.0.0.1:8081/")) .header("Host", "test.example.com") .build(); client.send(request, HttpResponse.BodyHandlers.ofString()); As a result I see that the above code sends: GET / HTTP/1.1 Connection: Upgrade, HTTP2-Settings Content-Length: 0 Host: 127.0.0.1:8081 HTTP2-Settings: AAEAAEAAAAIAAAABAAMAAABkAAQBAAAAAAUAAEAA Upgrade: h2c User-Agent: Java-http-client/10

JavaFX-11 with VSCode

﹥>﹥吖頭↗ 提交于 2019-11-28 01:21:27
I must be missing something obvious here... I am experimenting with VSCode (coming from Eclipse), but I am unable to get VSCode to see the JavaFX11 libraries. In the import statements, all references to JavaFX components are marked: [Java] The import javafx cannot be resolved In Eclipse, this is handled with a "User Library", which generates an entry in .classpath <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX11"> <attributes> <attribute name="module" value="true"/> </attributes> </classpathentry> While VSCode seemingly understands the rest of the .classpath from Eclipse,

How to get JavaFX and Java 11 working in IntelliJ IDEA [duplicate]

妖精的绣舞 提交于 2019-11-27 18:50:31
问题 This question already has answers here : IntelliJ can't recognize JavaFX 11 with OpenJDK 11 (4 answers) Closed 2 months ago . With the recent Java 11 release, JavaFX is no longer included in the JDK. I have an existing JavaFX project. I am interested in learning how to change it from a Java 10 project to a Java 11. I am certain I have installed Java 11 correctly, and I am able to change the default SDK from Java 10 to Java 11. What I don't know is how I might get JavaFX working with Java 11.

How to use jdk without jre in Java 11 [duplicate]

核能气质少年 提交于 2019-11-27 18:07:49
This question already has an answer here: How to get java 11 run-time environment working since there is no more jre 11 for download? 3 answers We are planning to migrate our Java 8 project to use Java 11. But I noticed that Java 11 doesn't have a JRE folder. In Java 9 and Java 10, folder structures are changed i.e. java\jdk1.x or java\jre1.x , where x is java 9 or 10. But in Java 11, I am getting only one folder, i.e. java\jdk-11 . How will my client use my application without jre? What I understood is that Java 11 is enforcing to modularize our application, and using jlink is needed to

Build and deploy javafx application using java11

自作多情 提交于 2019-11-27 15:31:31
I followed the steps in https://blog.jetbrains.com/idea/2013/03/packaging-javafx-2-applications-in-intellij-idea-121/ but when I try to build artifacts the as in the last step I get this error Error:Java FX Packager: Can't build artifact - fx:deploy is not available in this JDK I know JavaFX has been removed from java11 my question is what should I do to build a .jar or .exe here is a hello world app for quick testing. Unfortunately, you won't be able to build your jar using JFX11 this way, as apparently the packager was removed from the JFX SDK. There is hope it will be implemented in a

Running javafx sample on JDK 11 with OpenJFX 11 JMODS on Module Path

血红的双手。 提交于 2019-11-27 14:50:52
问题 I have downloaded the JavaFX Jmod files from OpenJFX project and placed them in the directory G:\openjfx\javafx-jmods-11 . I am using OpenJDK 11 which has no JavaFX jmod in JAVA_HOME/jmods i.e it doesn't come with JavaFX distribution. Module info file: module gui{ requires javafx.graphics; requires javafx.controls; exports com.test; } I compile with following: javac -p G:\openjfx\javafx-jmods-11 -d mods --module-source-path src src\gui\com\test\*.java src\gui\module-info.java Compilation

The jdk.incubator.httpclient module not found in Java11

对着背影说爱祢 提交于 2019-11-27 14:50:12
Using the early access build for JDK/11 to compile an existing code based on Java-9 which was using a VM argument --add-modules jdk.incubator.httpclient to resolve the HTTP/2 client incubator module now ends up with a compilation error Module not found: jdk.incubator.httpclient Java version details :- java 11-ea 2018-09-25 Java(TM) SE Runtime Environment 18.9 (build 11-ea+11) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+11, mixed mode) With the standardization of the HTTP Client API , the incubated APIs are now removed. The module name and the package name of the standard API will be

Empty methods noticeably slower in Java 11 than Java 8

余生颓废 提交于 2019-11-27 11:04:05
问题 I was comparing the performance of JDK 8 and 11 using jmh 1.21 when I ran across some surprising numbers: Java version: 1.8.0_192, vendor: Oracle Corporation Benchmark Mode Cnt Score Error Units MyBenchmark.emptyMethod avgt 25 0.362 ± 0.001 ns/op Java version: 9.0.4, vendor: Oracle Corporation Benchmark Mode Cnt Score Error Units MyBenchmark.emptyMethod avgt 25 0.362 ± 0.001 ns/op Java version: 10.0.2, vendor: Oracle Corporation Benchmark Mode Cnt Score Error Units MyBenchmark.emptyMethod