如何检测系统中的java的版本是多少

# Check for the correct version of java

java_version := $(shell java -version 2>&1 |head -n 1 | grep '^java .*[ "]1\.6[\. "$$]')

ifneq ($(shell java -version 2>&1 | grep -iopenjdk),)

java_version :=

endif

ifeq ($(strip $(java_version)),)

$(info ************************************************************)

$(info You are attempting to build with the incorrectversion)

$(info of java.)

$(info $(space))

$(info Your version is: $(shell java -version2>&1 | head -n 1).)

$(info The correct version is: Java SE 1.6.)

$(info $(space))

$(info Please follow the machine setup instructionsat)

$(info$(space)$(space)$(space)$(space)http://source.android.com/source/download.html)

$(info************************************************************)

$(error stop)

endif

 

1.java_version :=

  复习关于Make中关于赋值的操作符的区别

  =

  +=

  :=

2.$(shell ...)

  复习关于$符号在make文件中的2种使用方式

  $(var) or${var}

  $(strip) or${strip}

3.java -version 2>&1

  复习关于2>&1 在这个地方指代什么内容

4.|

  复习在bash中关于管道,输入输出重定向的使用

  > <>>  << 在命令行组合中的作用

5.head 命令

  复习head命令在查看文件时的使用方法

  head top catmore last 的区别

  head -n number

  head -cbyte_number

6.grep 命令

  复习关于正则表达式的知识

  ^

  .*

[]

\.

$$

''

7.ifneqifeq 在make文件中的使用

8.grep -i 忽略大小写

9.openjdk

10.strip函数在make文件中的使用

11.info 函数在make文件中的使用

12.error函数在make文件中的使用

 

下面关于javac的可以类别上面关于java的介绍

# Check for the correct version of javac

javac_version := $(shell javac -version 2>&1 |head -n 1 | grep '[ "]1\.6[\. "$$]')

ifeq ($(strip $(javac_version)),)

$(info************************************************************)

$(info You are attempting to build with the incorrectversion)

$(info of javac.)

$(info $(space))

$(info Your version is: $(shell javac -version2>&1 | head -n 1).)

$(info The correct version is: 1.6.)

$(info $(space))

$(info Please follow the machine setup instructionsat)

$(info $(space)$(space)$(space)$(space)http://source.android.com/source/download.html)

$(info************************************************************)

$(error stop)

endif

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值