最近研究JVM源码,看的书是<<实战java虚拟机>>,书里有要用以下命令下载jdk10的源码

hg clone http://hg.openjdk.java.net/jdk10/jdk10

然后了解下hg命令,原来hg是Mercurial(轻量级分布式版本控制系统)的命令,Mercurial 与Git类似,也是版本管理工具。

Mac上要使用hg命令,只需要安装Mercurial 即可,我在网上找到资料,安装使用如下命令

sudo easy_install mercurial

但是这个命令执行并不成功,如下图一样报了很多错误然后结束了。

于是又找其他的方案,参考http://macappstore.org/mercurial/ 里的说明

Press Command+Space and type Terminal and press enter/return key.
# 打开Termial终端
Run in Terminal app:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
and press enter/return key.
# 在终端中执行 "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null" 命令然后回车

If the screen prompts you to enter a password, please enter your Mac's user password to continue. When you type the password, it won't be displayed on screen, but the system would accept it. So just type your password and press ENTER/RETURN key. Then wait for the command to finish.
# 如果需要输入密码就输,输的时候可能在屏幕上面并不展示,但是实际上是输入进去的了,输入完以后回车

Run:
brew install mercurial
# 然后执行 `brew install mercurial` 命令

Done! You can now use mercurial.
# ok了,可以用了

安装好后,执行hg命令会有相应的提示,就说明安装成功了,就可以进行源码的下载了

@localhost ~ % hg
Mercurial Distributed SCM

basic commands:

 add           add the specified files on the next commit
 annotate      show changeset information by line for each file
 clone         make a copy of an existing repository
 commit        commit the specified files or all outstanding changes
 diff          diff repository (or selected files)
 export        dump the header and diffs for one or more changesets
 forget        forget the specified files on the next commit
 init          create a new repository in the given directory
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐