这适用于某些URL,例如https://speed.hetzner.de/10GB.bin它在我的Subscriber中打印了很多调试消息,所以我的控制台看起来像这样:
I got 16384 bytes (6396)
Got data!
I got 16384 bytes (6397)
Got data!
I got 16384 bytes (6398)
Got data!
I got 16384 bytes (6399)
Run Code Online (Sandbox Code Playgroud)
和taskmanager说java正在下载~50Mbit/s(我的完全下载速度)
但是你可以在这里下载文件的网址,你可以在这里下载https://map.usbcraft.net/file/usbpc-downloads/java_http_client.fail这是非常不同的.控制台仅显示以下消息:
Starting download...
Version: HTTP_1_1 Status code 200 Got headers back java.net.http.HttpHeaders@d4ccf412 { {accept-ranges=[bytes], cache-control=[max-age=0, no-cache, no-store], cf-ray=[46ed5b5aeaf9721d-AMS], connection=[keep-alive], content-length=[2147483648], content-type=[application/octet-stream], date=[Wed, 24 Oct 2018 15:08:07 GMT], expect-ct=[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"], server=[cloudflare], set-cookie=[__cfduid=dcba8bb98269e665c521493baf25d0b6d1540393686; expires=Thu, 24-Oct-19 15:08:06 GMT; path=/; domain=.usbcraft.net; HttpOnly], x-bz-content-sha1=[none], x-bz-file-id=[4_zd729cdbbb41cd50850150a12_f201d3478bea24efd_d20181024_m130349_c001_v0001109_t0059], x-bz-file-name=[java_http_client.fail], x-bz-info-src_last_modified_millis=[1540386142160], x-bz-upload-timestamp=[1540386229000]} }
Content-Length parsed to int: …Run Code Online (Sandbox Code Playgroud) 我正在使用最新版本的Intellij Idea,并将jdk设置为11。执行我的项目时,它将引发异常noclassfoundexception:java.sql.SQLException。
在Intellij的Java编译器设置中,我提到的项目字节码版本为11。在项目结构设置中,我也将模块jdk设置为11。
有没有办法配置OpenJFX 11将其DLL提取到不同的用户指定目录?
在尝试将现有Java 10/Maven项目迁移到Java 11时,我尝试使用OpenJDK 11.为了使代码构建工作,我需要将JavaFX JAR添加到Maven pom.xml配置文件中(因为JavaFX不再是Java 11的内置部分).
但是,在运行时,我发现由于OpenJFX将DLL文件提取到用户目录中然后访问失败而导致的错误(请参阅下面的错误).多年来我有许多项目在使用C:\ Users*目录时出错(来自Microsoft Windows干扰文件锁和目录权限,反病毒扫描等),所以我试图避免这些目录可能.Java项目在Windows 7和RedHat 7上的Java 10下正常工作,这似乎意味着Oracle的JavaFX 10 JAR没有将DLL提取到C:\ Users*目录中.OpenJFX似乎没有麻烦将DLL写入这些目录,但之后无法读取这些相同的文件.
我运行的是带有service-pack 1的Microsoft Windows 7 Professional 64位.我还没有尝试使用OpenJDK 11和OpenJFX在Linux上运行,但我认为OpenJFX也会尝试在该平台上提取其DLL.
OpenJFX导致的运行时Java错误示例:
Loading library prism_d3d from resource failed: java.lang.UnsatisfiedLinkError: C:\Users\MyUserName\.openjfx\cache\11\prism_d3d.dll: Access is denied
java.lang.UnsatisfiedLinkError: C:\Users\MyUserName\.openjfx\cache\11\prism_d3d.dll: Access is denied
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: C:\Users\MyUserName\.openjfx\cache\11\prism_sw.dll: Access is denied
java.lang.UnsatisfiedLinkError: C:\Users\MyUserName\.openjfx\cache\11\prism_sw.dll: Access is denied
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable …Run Code Online (Sandbox Code Playgroud) 我开发并分发了使用Apache Batik和JavaCV的Java Swing应用程序。我已经通过Java 1.6、7和8更新了它。macOS,Windows和Linux的安装程序是使用Javapackager构建的。Java 8的支持在19年1月终止,我找不到在新的LTS版本Java 11上打包和分发的解决方案。
JavaCV或Batik都不生产模块化jar,但是我设法将它们重新打包到可以在Java 11上编译并生成可运行jar的程度,app可以正常工作,但我不能打包以进行分发。我打算降级到Java 10以使用javapackager并从那里捆绑11个运行时,但是它使用jlink生成自定义运行时,因为JavaCV和Batik不是模块化的,所以jlink失败了。由于Batik和JavaCV中的引用不令人满意,即使我的应用程序在没有它们的情况下也能正常工作,但jdeps不会生成用于修补的module-info.class并使它们模块化。
结果,我将不得不离开Java 8的代码库,即使不再支持它,也要交付它。
我知道有一个调用来创建javapackager的替代品,但是直到Java 8被弃用之后才会出现。而且我仍然需要Batik和JavaCV项目来重构和构建模块化jar,以生成自定义运行时。
任何人都可以提供其他解决方案吗?我错过了什么吗?谢谢。
我将Java版本从Java 8切换到Java 11,似乎在Java 11中从JDK bin文件夹中删除了Javah,然后才在pom.xml中执行javah命令,如下所示
<execution>
<id>javah</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>javah</executable>
<arguments>
<argument>-classpath</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>-d</argument>
<argument>${build.path}/include</argument>
</arguments>
</configuration>
</execution>
Run Code Online (Sandbox Code Playgroud)
由于Javah已从JDK 11中删除,如何在pom中将上述javah命令替换为javac -h以与Java 11一起使用
我得到的错误是
无法在项目myProject上执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:exec(javac -h):命令执行失败。:进程退出,错误:2(退出值:2)
任何的想法?谢谢
我没有找到任何很好的例子来概述使用Java新的HTTP2支持.
在以前的Java(Java 8)版本中,我REST使用多个线程对服务器进行了多次调用.
我有一个全局参数列表,我会通过参数来做出不同类型的请求.
例如:
String[] params = {"param1","param2","param3" ..... "paramSomeBigNumber"};
for (int i = 0 ; i < params.length ; i++){
String targetURL= "http://ohellothere.notarealdomain.commmmm?a=" + params[i];
HttpURLConnection connection = null;
URL url = new URL(targetURL);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream());
wr.writeBytes(urlParameters);
wr.close();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
//Do some stuff with this specific http response …Run Code Online (Sandbox Code Playgroud) 我尝试编译新的模块化Java 11应用程序时收到以下错误消息:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\inter\.m2\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module
Run Code Online (Sandbox Code Playgroud)
这似乎是由于依赖关系引起的问题。我什至找不到哪个模块将其引入,因此我可以对其进行更新。
我正在使用openjdk 11.0.2,IntelliJ 2018.3.4,Maven
关于如何解决或解决此问题的任何建议?我发现有关此问题的文档很少。
从jShell脚本内部,是否可以访问或注册也在创建JShell的代码中定义的变量?
当前,似乎没有机制可以访问或向Shell实例注册变量,或者从JShell内部不返回任何字符串类型(例如对象或lambda等)。
例如:
导入jdk.jshell.JShell;
导入jdk.jshell.JShellException;
导入jdk.jshell.SnippetEvent;
导入java.util.List;
公共班级主要{
公共静态void main(String [] args)抛出JShellException {
var localVar = 1;
JShell shell = JShell.create();
//如何在shell实例中注册localVar变量或从作用域访问变量
列表事件= shell.eval(“ var x = localVar;”);
SnippetEvent event = events.get(0);
System.out.println(“种类:” + event.snippet()。kind()+“,值:” + event.value());
}
}
我已将一个项目从Java 1.8迁移到Java11。在此过程中,我必须安装较新版本的eclipse才能使用Java 11 jdk。
Eclipse IDE for Enterprise Java Developers.
Version: 2018-12 (4.10.0)
Build id: 20181214-0600
Run Code Online (Sandbox Code Playgroud)
该应用程序是一个maven项目,可以从命令行成功编译,但是eclipse抱怨它无法解析javax.xml.datatype.XMLGregorianCalendar。
我已经使用右键单击项目Maven->更新项目,从Eclipse更新了Maven项目。
我从项目中可以看到maven依赖项jaxp-api-1.4.2.jar被包括在内,并且类javax.xml.datatype.XMLGregorianCalendar存在。
如何解决Eclipse抱怨类javax.xml.datatype.XMLGregorianCalendar无法解决的问题?
带有未解析的javax.xml.datatype.XMLGregorianCalendar的类:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.08.17 at 01:14:19 PM BST
//
package com.qlsdistribution.fps.production.contentagent;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import …Run Code Online (Sandbox Code Playgroud) 我有一个JavaFX 8项目,该项目是在Windows 10上使用NetBeans 8.2开发的。我以此为基础构建的JAR已在华硕Tinker板上运行。
我想使用JDK 11和JavaFX 11来利用一些新功能,并希望获得一些性能提升。安装NetBeans 10后并在以下教程的帮助下:https : //openjfx.io/openjfx-docs/#introduction(JavaFX和NetBeans>非模块化与Maven一节),我已经成功移植并可以在我的机器上运行该应用程序Windows系统。
通过IDE或使用命令提示符:java --module-path%PATH_TO_FX%--add-modules = javafx.c ontrols,javafx.fxml,javafx.graphics,javafx.media -jar Praatpaal2-2.0-jar-with -dependencies.jar
与JavaFX 8相比,现在将JavaFX模块添加为模块。
但是,当我在华硕Tinker Board(正在运行Tinker OS(Debian))上执行相同操作时,出现以下错误:
引导层java.lang.module.FindException初始化期间发生错误:javafx.base的哈希(d87df23ee5c54c7ff062c4f8572bab8aaf6c1775854662008fccdb993957bcad)与预期的哈希(320c5b0ffaf22fec9daf0c3e364f6598631b333fa95015055)
关于此哈希不匹配的信息很少。我的怀疑是它要么尝试加载Windows版本的javafx.base.jar,要么我在Maven pom.xml中使用org.openjfx,但在运行时引用了GluonHQ JavaFX,或者我的模块化设置有问题。
pom.xml的依赖项和构建部分如下所示:
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11.0.2</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11.0.2</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11.0.2</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11.0.2</version>
<classifier>linux</classifier>
</dependency>
<dependency> …Run Code Online (Sandbox Code Playgroud)