java-9

Difference between RxJava API and the Java 9 Flow API

只谈情不闲聊 提交于 2019-12-20 07:59:10
问题 It seems on every iteration of Java for the last few major releases, there are consistently new ways to manage concurrent tasks. In Java 9, we have the Flow API which resembles the Flowable API of RxJava but with Java 9 has a much simpler set of classes and interfaces. Java 9 Has a Flow.Publisher , Flow.Subscriber , Flow.Processor , Flow.Subscription , and SubmissionPublisher , and that's about it. RxJava Has whole packages of Flow API-like classes, i.e. io.reactivex.flowables , io.reactivex

How to run a JShell File?

拈花ヽ惹草 提交于 2019-12-19 16:12:40
问题 I'd like to run an entire file with JShell like: $ jshell my-jshell-skript.java Where e.g. the content of my my-jshell-skript.java is 40 + 2; . Or alternatively an executable like: #!/usr/bin/jshell 40 + 2 Is this possible now or do I still have to take the old way over a Java-Main-Class? Edit 1: Windows-Problem On Windows, there is still no solution for me: C:\JDKs\jdk9.0.0.0_x64\bin>type foo.jsh 1 + 1 C:\JDKs\jdk9.0.0.0_x64\bin>jshell.exe foo.jsh | Welcome to JShell -- Version 9 | For an

gradle java9 Could not target platform: 'Java SE 9' using tool chain: 'JDK 8 (1.8)'

纵然是瞬间 提交于 2019-12-19 13:57:25
问题 I want to use java9 on my gradle project inside eclipse oxygen. When I run: Run as> Gradle Test on GreeterTest.java with the following code: package hello.test; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import hello.Greeter; class GreeterTest { @Test void test() { Greeter greeter = new Greeter(); assertEquals("Hello world", greeter.sayHello()); } } and with the class I test as: package hello; public class Greeter { public String sayHello() { return

Webpshere Liberty support for Java 9

非 Y 不嫁゛ 提交于 2019-12-19 10:28:07
问题 Does Webpshere Liberty support for Java 9? as of latest beta it is mentioned fully compatible with Java 8 but there is not mentioning about upgrade. Whether Java 9 Module path can be supported with Websphere liberty? 回答1: Websphere Liberty mostly works with Java 9 in "toleration mode", meaning that Liberty and apps can run on Java 9, but you can't take advantage of Java 9 modularity yet. You can find more detailed progress of OpenLiberty (an open-source subset of Websphere Liberty) support

Compile a JDK 8 project + a JDK 9 “module-info.java” in Gradle

此生再无相见时 提交于 2019-12-19 10:18:54
问题 I'm working on a Java library targeting JDK 8, and I'm building it in Gradle 5 using OpenJDK 11. In order to target JDK 8, I'm javac's --release option. However, I'd also like my library to be JPMS-compatible. In other words: I'd like to provide a module-info.class compiled with --release 9 (option 3 in Stephen Colebourne's scale), while all the rest is compiled with --release 8 . MCVE build.gradle : plugins { id 'java' id 'org.javamodularity.moduleplugin' version '1.4.1' // * } repositories

Troubleshooting Nashorn “Method code too large!” exception

风格不统一 提交于 2019-12-19 09:47:17
问题 Running jjs or ScriptEngine#eval on my JavaScript (https://gist.github.com/also/005fd7c200b20f012e10) crashes with this exception and no more details: Exception in thread "main" java.lang.RuntimeException: Method code too large! at jdk.internal.org.objectweb.asm.MethodWriter.getSize(MethodWriter.java:2065) at jdk.internal.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:856) at jdk.nashorn.internal.codegen.ClassEmitter.toByteArray(ClassEmitter.java:577) at jdk.nashorn.internal

How to run a java application with jshell?

本小妞迷上赌 提交于 2019-12-19 09:42:08
问题 How to run a java application with jshell? It should be able to specify classpath and call java command and pass some arguments like bash does,e.g, #!/bin/bash $ARGS=... $CLASSPATH=... java -cp $CLASSPATH $ARGS com.example.MyApp Update: I think a wrapper of Runtime or Process is required, e.g., jshell> private String executeCommand(String command) { ...> ...> StringBuffer output = new StringBuffer(); ...> ...> Process p; ...> try { ...> p = Runtime.getRuntime().exec(command); ...> p.waitFor()

Specific Collection type returned by Convenience Factory Method in Java 9

倖福魔咒の 提交于 2019-12-19 09:09:42
问题 In Java 9 we have convenience factory methods to create and instantiate immutable List, Set and Map. However, it is unclear about the specific type of the returned object. For ex: List list = List.of("item1", "item2", "item3"); In this case which type of list is actually returned? Is it an ArrayList or a LinkedList or some other type of List? The API documentation just mentions this line, without explicitly mentioning that its a LinkedList: The order of elements in the list is the same as the

GlassFish 5.0 exception and port 4848 not responding

微笑、不失礼 提交于 2019-12-19 08:07:49
问题 Yesterday i downloaded GlassFish 5.0 and JDK9. When I'm trying to run server with asadmin start-domain GlassFish send to me exception When I try to use "asadmin start-domainAfter" I got respond: "Remote server does not listen request on [localhost 4848]. Is the serwer up?" Any can help me with this? I looked for solution at google, I tried kill process using port 4848, change port 4848 in domain.xml on another one, nothing helps. It's my firts time with glassfish I don't know what to do.

What's the correct to make FXML members in Java 9 or 10?

旧时模样 提交于 2019-12-19 07:22:14
问题 After upgrading to Java 10 (from 8), I'm getting these errors: InaccessibleObjectException: Unable to make field private javafx.scene.control.Button tech.flexpoint.dashman.controllers.configurator.RegistrationController.registerButton accessible: module tech.flexpoint.dashman does not "opens tech.flexpoint.dashman.controllers.configurator" to module javafx.fxml Does it mean I should make them public? Does that make the @FXML annotation essentially useless in Java 9 and 10? 回答1: Since you're