Back to Computer_Languages

See Also MavenJava 8

Java Programming Language

1. 语法

Java是一种多范式语言,支持面向对象、结构化和命令式(Imperative)编程。

入门的第一步是学习语法,我推荐The Java™ Tutorials,如果对英文无感,随便找本书看看也行。《Thinking in Java》是用来进阶的书,踏踏实实写上几万行代码再看也不迟。

1.1. Annotations

注解(Annotations),也叫元数据。一种代码级别的说明。它是JDK 5 及以后版本引入的一个特性,与类、接口、枚举是在同一个层次。它可以声明在包、类、字段、方法、局部变量、方法参数等的前面,用来对这些元素进行说明,注释。

1.2. Generic

泛型(Generic)是JDK 5中引入的一个新特性,允许在定义类和接口的时候使用类型参数(type parameter)。声明的类型参数在使用时用具体的类型来替换。

2. Platform

2.1. JDK

2.1.1. JDK Libraries

2.2. Third party Libraries

2.2.1. Apache Projects

Apache Jakarta™ Project: 2011/12/21 - Jakarta has been retired. http://attic.apache.org/projects/jakarta.html

Apache Commons: 一堆有用的类库

Apache Maven: 打包工具

Apache logging services:

Apache JMeter™: 性能测试工具

Apache Tomcat®: 持久而弥新的 Servelet/JSP 容器

Apache HttpComponents:

2.2.2. Spring Projects

Spring Framework

Spring Data: SpringSource 的一个父项目,旨在统一和简化对各类型持久化存储, 而不拘泥于是关系型数据库还是 NoSQL 数据存储。

Spring Security

Spring Boot

Spring Cloud

2.2.3. Others Projects

JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

Guava is a set of core libraries produced by google.

Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.

2.3. Java Virtual Machine

2.4. Switch JDK Version

## Linux
[root@localhost ~]# update-alternatives --display java
java - status is manual.
 link currently points to /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
...
[root@localhost ~]# update-alternatives --config java 

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
 + 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*  4           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 4
[root@localhost ~]# java -version
openjdk version "1.8.0_12"
OpenJDK Runtime Environment (build 1.8.0_12-b3)
OpenJDK 64-Bit Server VM (build 25.12-b3, mixed mode)

## OS X
## Install with brew
➜  buck brew cask install java
➜  buck /usr/libexec/java_home -V                          
Matching Java Virtual Machines (2):
    1.8.0_20, x86_64:   "Java SE 8"     /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
    1.7.0_80, x86_64:   "Java SE 7"     /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
➜  buck export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
➜  buck java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

https://stackoverflow.com/questions/26993101/switching-between-different-jdk-versions-in-windows

## Windows
setx JAVA_HOME "C:\Program Files\Java\jdk1.7.0_72" /m
setx PATH "%JAVA_HOME%\bin";%PATH%

3. Dev Guide

Java Dev Guidelines

3.1. Secure Coding Guidelines

3.2. Core Dump

4. Reference

MainWiki: Java (last edited 2019-02-05 03:54:11 by twotwo)