如何知道我是使用Open JDK还是Oracle JDK?

时间:2015-11-24 13:34:39

标签: java openjdk jdk1.7 oraclejdk

使用java -version给我这个。

java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

是OpenJDK还是OracleJDK?

3 个答案:

答案 0 :(得分:8)

我认为您正在使用OracleJDK。

正如我在google搜索中看到的那样,openJDK --version输出是这样的:

  

java -version

     

openjdk版本" 1.8.0-internal"

     

OpenJDK Runtime Environment(build 1.8.0-internal-0)

     

OpenJDK 64位零虚拟机(构建25.0-b20内部解释模式)

请参阅:http://mail.openjdk.java.net/pipermail/jdk8-dev/2013-July/002840.html

答案 1 :(得分:3)

关于debian,jessie-backports,openjdk-8:

           SELECT TRM_ID_TURMA
                 , TRM_HORA_INICIO
                 , TRM_HORA_FIM
                 , TRM_DIA
                 , TRM_VAGAS
                 , MGN_NOME
                 , PROF.USU_NOME AS PROFESSOR
                 , ALU_MATRICULA
                 , USU.USU_NOME NOMEALUNO
              FROM [MGB].[dbo].[TB_TURMA]
             INNER JOIN TB_USUARIO PROF ON PROF.USU_ID_USUARIO = TRM_ID_PROFESSOR
             INNER JOIN TB_NIVEL_TURMA ON NTR_ID_NIVEL_TURMA = TRM_ID_NIVEL
             INNER JOIN TB_MGB_NIVEL ON MGN_ID_MGB_NIVEL = NTR_ID_MGB_NIVEL
             INNER JOIN TB_LOCAL ON LOC_ID_LOCAL = TRM_ID_LOCAL
              LEFT JOIN TB_TURMA_ALUNO ON TAL_ID_TURMA = TRM_ID_TURMA
              LEFT JOIN TB_ALUNO ON ALU_ID_ALUNO = TAL_ID_ALUNO
              LEFT JOIN TB_USUARIO USU ON USU.USU_ID_USUARIO = ALU_ID_USUARIO
             WHERE TRM_ID_ACADEMIA = 27
               AND TRM_STATUS >= 0
               AND (TAL_STATUS IS NULL OR TAL_STATUS >= 0)
             ORDER BY TRM_HORA_INICIO,  TRM_HORA_FIM, TRM_DIA, ALU_MATRICULA, NOMEALUNO

使用ubuntu ppa for oracle-java-8:

if ($resultdelete->affected_rows> 0)  {

我会假设,字符串" java"在开头表示Oracle Java,而OpenJDK可以让你" openjdk"。

答案 2 :(得分:0)

用Java代码调用sun.misc.Version#println会将版本信息转储到stderr。如果要从Java代码中获取JDK版本。

package bj.tmp;

import sun.misc.Version;

public class Foo {
    public static void main(String[] args) {
        Version.println();
    }
}

赞:

java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)