OpenJDK

How to change maven java home

元气小坏坏 提交于 2019-11-27 19:34:46
I want to change maven java home which is open jdk with sun jdk. How can I do it ? root@ak-EasyNote-TM98:~# mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.6.0_24, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre Default locale: tr_TR, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-34-generic", arch: "amd64", family: "unix" Edit: So sorry. I forgot to write the below code : root@ak-EasyNote-TM98:~$ java -version java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM

聊聊openjdk的jvm.cfg文件

末鹿安然 提交于 2019-11-27 18:14:47
序 本文主要研究一下openjdk的jvm.cfg文件 jdk8 /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/lib/jvm.cfg # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. # NOTE that this both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=<jvm_dir>" option, but that too is unsupported # and may not be available in a future release. # -server KNOWN -client IGNORE 对于jdk8该文件在JAVA_HOME/jre/lib/目录下;其注释显示该配置文件用于配置java

Java `OutOfMemoryError` when creating < 100 threads

╄→гoц情女王★ 提交于 2019-11-27 17:56:02
问题 I've been reading and testing and banging my head on the wall for over a day because of this error. I have some Java code in a class called Listener that looks like this ExecutorService executor = Executors.newFixedThreadPool(NTHREADS); boolean listening = true; int count = 0; while (listening) { Runnable worker; try { worker = new ServerThread(serverSocket.accept()); // this is line 254 executor.execute(worker); count++; logger.info("{} threads started", count); } catch (Exception e1){ //...

Is it possible to browse the source of OpenJDK online?

﹥>﹥吖頭↗ 提交于 2019-11-27 17:04:34
Is it possible to browse the source code of OpenJDK online, just like I can do with SourceForge's projects? I never used Mercury before, so I felt confused. (Note: I don't want to download the source. I just want to browse it online, to see how some methods are implemented.) Use http://hg.openjdk.java.net/ as duncan suggested. The Mercurial interface there is quite confusing if you are not used to it, and since this is a large project, it can be hard to find what you are looking for. Here is an example: To find the JDK6 implementation java.util.List, select "jdk6", "jdk", select browse. Then

Why use 1<<4 instead of 16?

北战南征 提交于 2019-11-27 16:03:28
The OpenJDK code for java.util.HashMap includes the following line: static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16 Why is 1 << 4 used here, and not 16 ? I'm curious. It's to emphasize that the number is a power of two, and not a completely arbitrary choice. It thus alerts developers experimenting with different numbers that they should use other numbers in the pattern (e.g., 1 << 3 or 1 << 5 , rather than 20 ) so they don't break the methods which rely on the power of two requirement. There is a comment just above : /** * The default initial capacity - MUST be a power of two. */

Is Sun Java really necessary for using Android SDK on Ubuntu 10.10? I prefer OpenJDK

爷,独闯天下 提交于 2019-11-27 14:38:52
问题 I would prefer to just use openjdk-6-jdk (version 6b20-1.9.1-1ubuntu3). But I'm just starting the Android SDK installation, so if Sun (Oracle) Java is really needed, I suppose now is the time to install it. Any advice? 回答1: I'm using JDK for working on Android and it's fine :) java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.1) (6b20-1.9.1-1ubuntu3) OpenJDK 64-Bit Server VM (build 17.0-b16, mixed mode) And eclipse plugin too :) 回答2: I tried it and it is working.

一次Collectors.toMap的问题

此生再无相见时 提交于 2019-11-27 14:19:31
概述   虽然JDK9.0已经出来了,不过我们系统最近才开始全面引入JDK1.8,JDK1.8也已经出来了好久了,各方面都挺稳定的。最近在使用lambda表达式的Collectors.toMap方法时就遇到了一个问题。 大致源码如下: public class Test { public static void main(String[] args) { // initMemberList为获取数据的方法 List<Member> list = Test.initMemberList(); Map<String, String> memberMap = list.stream().collect(Collectors.toMap(Member::getId, Member::getImgPath)); System.out.println(memberMap); } } class Member { private String id; private String imgPath; // get set省略 } 运行程序,直接提示: Exception in thread "main" java.lang.NullPointerException at java.util.HashMap.merge(HashMap.java:1224) at java.util.stream

Collectors.toMap的问题

旧城冷巷雨未停 提交于 2019-11-27 14:19:10
概述   虽然JDK9.0已经出来了,不过我们系统最近才开始全面引入JDK1.8,JDK1.8也已经出来了好久了,各方面都挺稳定的。最近在使用lambda表达式的Collectors.toMap方法时就遇到了一个问题。 大致源码如下: public class Test { public static void main(String[] args) { // initMemberList为获取数据的方法 List<Member> list = Test.initMemberList(); Map<String, String> memberMap = list.stream().collect(Collectors.toMap(Member::getId, Member::getImgPath)); System.out.println(memberMap); } } class Member { private String id; private String imgPath; // get set省略 } 运行程序,直接提示: Exception in thread "main" java.lang.NullPointerException at java.util.HashMap.merge(HashMap.java:1224) at java.util.stream

bezier path widening

徘徊边缘 提交于 2019-11-27 14:02:45
问题 I have a bezier curve B with points S, C1, C2, E, and a positive number w representing width. Is there a way of quickly computing the control points of two bezier curves B1, B2 such that the stuff between B1 and B2 is the widened path represented by B? More formally: compute the control points of good Bezier approximations to B1, B2, where B1 = {(x,y) + N(x,y) (w/2) | (x,y) in C} B2 = {(x,y) - N(x,y) (w/2) | (x,y) in C}, where N(x,y) is the normal of C at (x,y). I say good approximations

JDK, JRE, Java: Version Confusion!

空扰寡人 提交于 2019-11-27 13:54:04
问题 Although I'm not a real Java developer (yet), I feel like I should know this by now, but I'm still very confused. My question has two parts: What is the difference between the so-called (as I've seen it) "Sun JDK", OpenJDK, and GCJ ? At various times, I've seen each of the following thrown around, making it very confusing to understand which version numbers actually apply to what. Can someone please help me sort this out? Java 6 Java 1.6 JDK 6 JDK 1.6 JRE 1.6 JVM 11.0 Note: I do understand