OpenJDK

JDK快速安装与配置

ε祈祈猫儿з 提交于 2019-11-27 12:45:12
​ JDK快速安装与配置 Debian/Ubuntu/LinuxMint 系列 1、添加ppa源 1 sudo add-apt-repository ppa:openjdk-r/ppa # 需要回车一下 2、更新并等待自动安装 1 sudo apt-get update 2 sudo apt-get install openjdk-8-jdk -y 3、以上便安装成功,如果系统中存在多个jdk版本,用以下命令切换并选择合适版本即可 1 sudo update-alternatives --config java 2 sudo update-alternatives --config javac 4.测试java运行环境 1 java -version 2 javac -version CentOS/RedHat/Fedora 系列 1、查找java相关jdk,看看能安装那些版本 1 yum -y list java* 2、安装jdk8(必须使用root用户) 1 yum -y install java-1.8.0-openjdk* 3、测试java运行环境 1 java -version 2 javac -version 结果: [root@yccx ~]# java -version openjdk version "1.8.0_222" OpenJDK Runtime

Java Attach API

与世无争的帅哥 提交于 2019-11-27 09:19:09
catalog 1. instrucment与Attach API 2. BTrace: VM Attach的两种方式 3. Sun JVM Attach API 1. instrucment与Attach API JDK5中增加了一个包java.lang.instrucment,能够对JVM底层组件进行访问。在JDK 5中,Instrument 要求在运行前利用命令行参数或者系统参数来设置代理类,在实际的运行之中,虚拟机在初始化之时(在绝大多数的 Java 类库被载入之前),instrumentation的设置已经启动,并在虚拟机中设置了回调函数,检测特定类的加载情况,并完成实际工作 ​在Java5中,开发基于Instrucment的应用,需要以下几个步骤 1. 编写premain函数 ​2. jar文件打包 ​3. 运行agent 但是在实际的很多的情况下,我们没有办法在虚拟机启动之时就为其设定代理,这样实际上限制了instrument的应用。而Java SE 6的新特性改变了这种情况,通过Java Tool API中的attach方式,我们可以很方便地在运行过程中动态地设置加载代理类,以达到instrumentation的目的 ​在JDK6中,针对这点做了改进,开发者可以在main开始执行以后,再开启自己的Instrucment程序 Attach

Ubuntu下安装Android Studio

纵然是瞬间 提交于 2019-11-27 07:33:02
我电脑的环境是Ubuntu 12.04 64位。 Android Studio下载地址: https://developer.android.com/sdk/installing/studio.html#download 看下各个环境的说明 下面开始安装 Ctrl+Alt+T打开terminal,进行解压: tar xzvf ~/Downloads/android-studio-bundle-130.677228-linux.tgz sudo mv android-studio /opt/ 然后开始安装: cd android - studio /bin/ ./studio. sh 可能会跑出来这句话: OpenJDK Runtime Environment ( IcedTea6 1 . 11 . 1 ) ( 6 b 24-1 . 11 . 1-4 ubuntu 2 ) OpenJDK 64 - Bit Server VM ( build 20 . 0 - b12 , mixed mode ) OpenJDK 64 - Bit Server VM ( build 20 . 0 - b12 , mixed mode ) WARNING: You are launching the IDE using OpenJDK Java runtime. ITS KNOWN TO HAVE

OpenJDK ZGC 源码分析(四)分页

隐身守侯 提交于 2019-11-27 07:16:16
1. 简介 与G1的分区类似,ZGC将堆划分成Page进行管理,不同的是ZGC中Page大小不是固定的,而是分为三种Small、Medium、Large三类。 本文将详细介绍ZGC的分页机制。 2. 代码分析 2.1 Page的类型 ZGC有3种不同的页面类型:小型(2MB),中型(32MB)和大型(2MB的倍数)。 zGlobals_linux_x86.hpp const size_t ZPlatformPageSizeSmallShift = 21; // 2M const size_t ZPlatformAddressOffsetBits = 42; // 4TB zGlobals.hpp // Page types const uint8_t ZPageTypeSmall = 0; const uint8_t ZPageTypeMedium = 1; const uint8_t ZPageTypeLarge = 2; // Page size shifts const size_t ZPageSizeSmallShift = ZPlatformPageSizeSmallShift; const size_t ZPageSizeMediumShift = ZPageSizeSmallShift + 4; const size_t ZPageSizeMinShift =

Java error: “Comparison method violates its general contract!”

ⅰ亾dé卋堺 提交于 2019-11-27 06:42:53
问题 I have this code: package org.optimization.geneticAlgorithm; import org.optimization.geneticAlgorithm.selection.Pair; public abstract class Chromosome implements Comparable<Chromosome> { public abstract double fitness(); public abstract Pair<Chromosome> crossover(Chromosome parent); public abstract void mutation(); public int compareTo(Chromosome o) { int rv = 0; if (this.fitness() > o.fitness()) { rv = -1; } else if (this.fitness() < o.fitness()) { rv = 1; } return rv; } } And every time I

Is the cacerts file missing in ubuntu 15.10 and openjdk-8-jdk?

主宰稳场 提交于 2019-11-27 05:55:14
问题 I just installed Ubuntu 15.10 and their openjdk-8-jdk (by apt-get). Now I am missing the cacerts file. There is a link at the usual location: ls -l /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts lrwxrwxrwx 1 root root 27 Oct 22 01:47 /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts -> /etc/ssl/certs/java/cacerts but nothing at /etc/ssl/certs/java/cacerts: stat /etc/ssl/certs/java/cacerts stat: cannot stat ‘/etc/ssl/certs/java/cacerts’: No such file or directory 回答1: This

Difference between openjdk-6-jre, openjdk-6-jre-headless, openjdk-6-jre-lib

…衆ロ難τιáo~ 提交于 2019-11-27 05:28:22
问题 I am having trouble understanding some of the basics of Java JRE. I need to run Java code in an embedded system and for this I need a minimal Java Runtime Environment installed in a Linux kernel, that is to say, the minimum package necessary for executing Java binaries. I think it is not possible to do this only with a JVM (the JRE package is necessary, am I wrong here?) The thing is, when looking at the Debian repositories I don't quite understand the differences between the packages openjdk

190801

吃可爱长大的小学妹 提交于 2019-11-27 05:27:43
1. 数组在Java和C++中的不同?   Java:首先应该明确的是,Java中的数组是对象,并且都是一维数组。二维数组和多维数组呢?其实二维数组中存放的是一维数组的引用,也是一个一维数组,多维数组也是如此,下面通过一个例子来证明这一观点: 首先,我们创建一个三维数组arr3D int[][][] arr3D = new int [5][][]; System.out.println(Arrays.deepToString(arr3D)); 输出: [null, null, null, null, null] 说明三维数组里存放着五个元素,都是空引用null 然后初始化一个元素 arr3D[2] = new int[3][]; 输出: [null, null, [null, null, null], null, null] 可以观察到,三维数组中索引为2的位置变成了一个充满三个null的一维数组(这里使用new关键字,创建了一个一维数组,然后三维数组原来的null引用变成了指向这个新建立的一维数组的新引用),不过还没有出现数字,那么再添加一个试试: arr3D[2][2] = new int[7]; 输出: [null, null, [null, null, [0, 0, 0, 0, 0, 0, 0]], null, null] 可以发现,在上一步新建立的一维数组中索引为2的位置

ECDHE cipher suites not supported on OpenJDK 8 installed on EC2 Linux machine

跟風遠走 提交于 2019-11-27 04:39:11
When starting jetty-distribution-9.3.0.v20150612 with openjdk 1.8.0_51 running on an EC2 Amazon Linux machine, is prints that all configured ECDHE suites are not supported. 2015-08-12 16:51:20 main SslContextFactory [INFO] Cipher TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 not supported 2015-08-12 16:51:20 main SslContextFactory [INFO] Cipher TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 not supported 2015-08-12 16:51:20 main SslContextFactory [INFO] Cipher TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 not supported 2015-08-12 16:51:20 main SslContextFactory [INFO] Cipher TLS_ECDHE_RSA_WITH_AES_128_GCM

update-alternatives: warning: /etc/alternatives/java is dangling

亡梦爱人 提交于 2019-11-27 00:57:01
问题 I am facing the problem while running the java program from command line. I have openjdk-6-jdk installed in my linux system and still shows the error relates with the openjdk-7-jdk. Initially i have jdk 7 installed in my system but ater i have removes it but still facing problem while running the application. after running the cammand sudo update-alternatives --config java it shows warning as follows update-alternatives: warning: /etc/alternatives/java is dangling, it will be updated with