OpenJDK

在Java类路径的目录中包含所有jar

帅比萌擦擦* 提交于 2019-12-14 16:45:38
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 有没有办法将所有jar文件包含在类路径的目录中? 我正在尝试 java -classpath lib/*.jar:. my.package.Program java -classpath lib/*.jar:. my.package.Program ,它无法找到这些jar中肯定存在的类文件。 我是否需要将每个jar文件分别添加到类路径? #1楼 在Windows下可以正常工作: java -cp "Test.jar;lib/*" my.package.MainClass 这不起作用: java -cp "Test.jar;lib/*.jar" my.package.MainClass 注意* .jar, 因此*通配符应单独使用 。 在Linux上,以下工作: java -cp "Test.jar:lib/*" my.package.MainClass 分隔符是冒号而不是分号。 #2楼 对我来说,这在Windows中有效。 java -cp "/lib/*;" sample 对于Linux java -cp "/lib/*:" sample 我正在使用 Java 6 #3楼 简短格式:如果您的主体位于jar中,则可能需要另外声明一个'-jar pathTo / yourJar / YourJarsName

自己动手为 OpenJDK 加速

送分小仙女□ 提交于 2019-12-14 13:02:08
JIT(即时编译)是个好东西,Java引领着整个行业。与HotSpot C2不同,JVM发行版仅针对操作系统和指令集架构优化,而C2会为特定操作系统(mac)、指令集(x86_64)和架构(Intel Broadwell)编译和优化class文件。这种方案具备可移植性,同时减少了提交给供应商的build数量。 与Java程序一起运行的本地代码非常重要,像C1编译器和垃圾回收器。那么问题来了,如果自己编译OpenJDK,能否显著提高提高应用程序吞吐量?答案似乎是肯定的。 构建JDK: 这里用AdoptOpenJDKMac OpenJDK 13与自己定制的OpenJDK 13进行比较,两者采用相同的33版本。以下是构建说明: 克隆OpenJDK git镜像 检出发行版33 根据文档运行bash configure。 bash configure --with-jvm-variants=server --with-jvm-features=link-time-opt \ –with-extra-cflags=’-Ofast -march=native -mtune=broadwell -funroll-loops -fomit-frame-pointer’ \ –with-extra-cxxflags=’-Ofast -march=native -mtune=broadwell

阿里开源 OpenJDK 发行版 Dragonwell

杀马特。学长 韩版系。学妹 提交于 2019-12-14 01:37:15
日有消息显示,阿里将于 21 日重磅发布其 OpenJDK 发行版 Alibaba Dragonwell。 我们知道 OpenJDK 是基于 GPL v2/Classpath Exception 的 JDK 开源版本,有许多公司都在 OpenJDK 的基础上提供了自己的发行版,比如 Oracle、AdoptOpenJDK、Azul、IBM 与 Red Hat,一般这些供应商会将自行衍生的 OpenJDK 版本加入一些商业/非商业支持选项。 去年 AWS 也推出了自己的 OpenJDK 发行版 Corretto,背后甚至有 Java 之父 James Gosling “站台”,一时间引起不小反响。 常规理解,AWS 搞 Corretto 也算是一种“造轮子”,但是它提供的长期支持包括安全修复、常用功能增强、GC 调度、防止内存溢出,以及改进的监控、报表和线程管理等,这样的能力再加上 AWS 强大的客户和社区生态依赖,有理由让人相信 Corretto 这轮子是具有较大实际意义的。 阿里此次将发布的 Alibaba Dragonwell 也声称 LTS,并且阿里的客户与开发社区体量自然也无庸赘述,那么同为“造轮子”,Alibaba Dragonwell 这个 OpenJDK 发行版会带来些什么呢? 阿里云智能资深技术专家李三红向开源中国提前透露了 Alibaba Dragonwell

difference between Sun JDK and open JDK

人盡茶涼 提交于 2019-12-14 01:28:23
问题 I am running into errors such as the following: Exception in thread "Thread-1" java.lang.IncompatibleClassChangeError: Found class com.sun.image.codec.jpeg.JPEGImageEncoder, but interface was expected I have built my JAR's using Sun JDK and I am running on OpenJDK . I am kind of stuck with this environment. Is there an easy way around this? Do I have to compile and run the code on OpenJDK ? 回答1: com.sun.image.codec.jpeg.JPEGImageEncoder by the name is a Sun-specific package so there's no

I would like to override FXMLLoader. How can I do that?

随声附和 提交于 2019-12-13 21:23:05
问题 As explained on oracle forum, I would like to create a generic controller for my FXML's. (See a this post). To do this, i would like to "override" FXMLLoader.java What would i do ? I suppose i have to find the JavaFX original source, modify it and rebuild it as a .jar file. I found the source code of JavaFX (http://hg.openjdk.java.net/openjfx/8/master/rt/) but i don't understand how to build it and to add it in my Eclipse project. As i'm starting a new project, I can choose another IDE if

OpenJDK 8: can't resolve hostname

帅比萌擦擦* 提交于 2019-12-13 15:21:52
问题 I'm trying to run slf4j with log4j 2.8 on openJDK 8 (latest version on Ubuntu 8u131-b11-0ubuntu1.17.04.1 ). When running simple java class via maven openjdk is unable to resolve local hostname: Exception in thread "AWT-EventQueue-0" java.lang.NoSuchFieldError: preferIPv6Address at java.base/java.net.InetAddress.init(Native Method) at java.base/java.net.InetAddress.init(Native Method) at java.base/java.net.InetAddress.<clinit>(InetAddress.java:333) at org.apache.logging.log4j.core.util

Why does my Eclipse crash all the time?

佐手、 提交于 2019-12-13 12:24:55
问题 Somehow stupid question, I have to admit - hope it won't cost me too many points. To make it clear: I would also be happy if you can help me find the reason for the crashes. I wouldn't expect a precise answer. However, I don't see why my Eclipse is crashing (freezing) all the time. Mostly when I save a file. For some reason, crashes seem to increase lately... I use Eclipse Helios (Version: 3.6.1) and Java version 1.6.0_20 (OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu2)

Cannot run maven2 on Linux Ubuntu 12.04

梦想与她 提交于 2019-12-13 05:21:36
问题 I am trying to compile a program using maven in my Linux 12.04. In order to do, I use the mvn clean install command. However I get a build error: [ERROR] Unable to locate the Javac Compiler in: /usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/tools.jar Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). In most cases you can change the location of your Java installation by setting the JAVA_HOME environment variable. I check the path and

How to use uprobe to trace OpenJDK HotSpot source code?

旧时模样 提交于 2019-12-13 03:19:47
问题 I try to follow the instructions from link In this example, Tracing func_abc() in my test program, and including user-level stacks: # ./uprobe -s p:/root/func_abc:func_c Tracing uprobe func_c (p:func_c /root/func_abc:0x4f4). Ctrl-C to end. func_abc-25394 [000] d... 19603250.054040: func_c: (0x4004f4) func_abc-25394 [000] d... 19603250.054056: <user stack trace> => <00000000004004f4> => <0000000000400527> => <0000000000400537> => <00007fca9f0e376d> func_abc-25394 [000] d... 19603251.054250:

Setting standalone = 'YES' using XMLEventWriter

血红的双手。 提交于 2019-12-12 21:38:18
问题 I'm using 'XMLEventWriter' to generate an XML file in Java. Code snippet is as below: XMLEventWriter writer = outputFactory.createXMLEventWriter(new FileWriter(outFile)); XMLEvent startEvent = eventFactory.createStartDocument("UTF-8","1.0",true); writer.add(startEvent); In spite of setting the third argument to 'true', I'm seeing that the generated XML document's header does not have standalone="YES" Could anyone suggest the changes (if any) to be made to make standalone="yes" appear in the