Java programmers perfect setting, Mac Programming Guide

 
 

I do not know how many times reinstall Windows, Linux distributions in exchange for going always feel satisfied, finally decided to buy a year of life in the first Mac.

Why Mac

Now the mobile terminal, the server running Unix systems are most familiar with Unix system is clearly necessary, Ubuntu is also a good choice for the novice, but I think Mac might be a better choice.

Hardware and software level

First, the underlying Mac OS X is Unix, and Unix is ​​true (standard, authorized, legitimate can use Unix trademark), a powerful command line

Fast and efficient (top menu bar, and more desk space, and a large number of global shortcuts consistent)

Abnormal nice trackpad (mouse no longer have to worry about the hand)

Retina screen (the code looked sharp)

Long life (meaning you can not charge a full day at the cafe programming)

High-performance SSD

Do not worry about all kinds of driving problems

Outstanding Industrial Design

Community level

If you are Swift / Object-C programmers, Mac standard should be okay

If you are a Ruby on Rails programmers, developers, including the vast majority ror DHH, including the devaluation of the development environment is Mac

For front-end Web developers, lethal Mac Retina screens presumably not a small bar

For the majority of Python, PHP programmers, Mac but comes with apache, php, python

Mac's Quick Start Guide

 
 

Here to share a perfect Apple Mac as a Java development setting.

Source Fonts

As software developers, we gaze for hours at the text on the screen, and select the text font is easy to read the code, and to help avoid fatigue. In addition to being part of macOS monospaced font, some designed specifically for the source code for free fonts, such as Hack or Source Code Pro.

 
 

Once you solve the source code text font, in the terminal and all the code editor to configure it.

Terminal configuration

 
 

transparency

We found that by default, the transparency setting terminal window are scattered, especially when other terminals include mobile content windows (e.g., build the output). The opacity set to 100% as a remedy.

Color scheme (profile)

In order to make the end-user experience on the Mac closer to Linux known, we recommend using the font of your choice to adjust the dark "Pro" configuration file, and replace some color with some slightly brighter color.

Homebrew

Homebrew 是macOS的包管理器。要安装它,请在终端中在一行中运行以下命令:

/ usr / bin / ruby -e“$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

版本控制系统

macOS自带Git和Subversion,但是它们往往过时了。要使用Homebrew安装最新的稳定版本,请运行该命令brew install git svn。

要看到其中的版本区别,在安装前和安装后运行git --version 或svn --version

Git配置

Git需要用户名和电子邮件才能正常工作。如果未配置,它将从本地用户和计算机名称派生出来,这几乎肯定是错误的。要设置它们,请在终端中运行以下命令(替换作者的示例值):

git config - 全局用户名cnJason

git config --global user email [email protected]

这只是非常基本的Git配置,在实践中很可能不够用。一个更实际的场景的Git配置方法是我的另一个博客帖子的主题[8]。

构建工具

要安装Java构建工具Maven和/或Gradle,请brew install maven gradle

在终端中运行该命令。

Java开发工具包(JDK)

将JDK安装到Mac上的简单方法是从Oracle下载[9],然后使用安装程序进行指导安装。虽然这种方法对于一些简单的情况可能是足够的,但它缺乏开发人员需要的灵活性。例如,一旦系统中存在较新版本的JDK,就不可能安装旧的JDK版本。此外,有切换安装了多个版本时默认没有简单的方法,它是不会轻易可以安装新的JDK有它可作为发展目标,但使用旧版本为系统默认运行构建工具。

下面介绍的设置提供了所有这些灵活性,甚至增加了一些工具来简化版本切换。

Homebrew Cask

Homebrew Cask 是Homebrew安装和管理交互式安装程序(如JDK)的应用程序的扩展。要安装和配置Cask,请在终端中运行以下命令:

 
 

cask上面创建的«非官方»别名可以帮助您避免打字brew cask。

jEnv

jEnv [11]是一个命令行工具,可以帮助管理系统上的多个Java版本,就像Debian Alternatives System一样。要安装和配置jEnv,请在终端中运行以下命令:

 
 

JDK安装

 
 

jEnv的配置和使用

用jEnv注册与Cask一起安装的JDK:jenv add JDK_HOME_PATH

JDK安装在/Library/Java/JavaVirtualMachines/jdk-VERSION/Contents/Home。

所以,一个完整的例子是: jenv add /Library/Java/JavaVirtualMachines/jdk-9.0.1/Contents/Home/

列出jEnv已知的所有JDK:jenv versions

请注意,每个JDK都可以使用不同的版本名称进行注册。jEnv派生这些版本的名字java -version

设置通用Java版本: jenv global 9.0.1

列出通用Java版本: jenv global

除了用Java版本,jEnv还支持目录和shell本地设置。由于这些主题将远远超出本文的范围,因此我们参考相应的文档[1。

结论

此时,最重要的版本控制系统和构建工具已经到位,并且可以轻松安装和管理JDK。现在,读者可以安装IDE和Profiler等更高级别的工具。

 
更多内容以及Mac软件获取关注Macdown.com

 

Guess you like

Origin www.cnblogs.com/macdown06/p/11876541.html