Java basic disk
preface
From the following points, write a separate article in detail. (ps: write only practical content)
1. Install and configure environment variables on the Mac side.
2. Basic grammar.
3. Object oriented.
4. Collection framework.
5. Exception frame.
6. IO framework (InputStream, OutputStream).
7. Multithreading.
8. Network.
9. Time.
10. Generic.
11. JVM (Java virtual machine).
12. Reflection mechanism.
Tip: the following is the main content of this article. The following cases can be used for reference
1, Install Java on the Mac side and configure environment variables.
Make Java run on your computer in the fastest way.
1. Download JDK8 version
Browser download Click: Oracle JDK.
The Mac version is available for download Development package at the end of dmg.
After downloading, double-click the installation to continue all the way.
2. Configure environment variables
If this is the first configuration, you can use touch ~ / bash_profile create profile The first file is on the Mac system
The default is hidden.
Solution: the terminal inputs the following command to permanently display the whole.
defaults write com.apple.Finder AppleShowAllFiles YES
Then use the command
open - e ~/.bash_profile
The system will open the file in the way of text editing, which is very practical.
Small partners who like to use vim can use
vim ~/.bash_profile
Click key i to enter information. Huixian insert in the lower left corner of the terminal.
Just paste the information into the file.
# java-environment-config JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home PATH=$JAVA_HOME/bin:$PATH CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib.dt.jar:. export JAVA_HOME export PATH export CLASSPATH
If you use the open command, you can directly press the shortcut keys command+s, command+w.
If using the vim command, first click the esc key, then hold down the shift + click the z key twice. ps (shift+zz) is the command ZZ
ZZ executes the exit VIM operation. If the text has been edited, save the file first.)
it's fine too! wq enter, see personal habits.
After saving the file, activate the configuration file.
source ~/.bash_profile
Verify whether the configuration environment is normal.
wangyanfei@wangyanfeideMBP ~ % java usage: java [-options] class [args...] (Execution class) or java [-options] -jar jarfile [args...] (implement jar file) Options include: -d32 Using 32-bit data model (If available) -d64 Using 64 bit data model (If available) -server choice "server" VM default VM yes server, Because you are running on a server computer. -cp <Catalogue and zip/jar Class search path for file> -classpath <Catalogue and zip/jar Class search path for file> use : Delimited directory, JAR archives and ZIP File list, Used to search for class files. -D<name>=<value> Set system properties -verbose:[class|gc|jni] Enable verbose output -version Output product version and exit -version:<value> warning: This feature is obsolete, Will be in Removed from future releases. The specified version is required to run -showversion Output product version and continue -jre-restrict-search | -no-jre-restrict-search warning: This feature is obsolete, Will be in Removed from future releases. Include in version search/Exclude user specific JRE -? -help Output this help message -X Output help for nonstandard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] Enables assertions at the specified granularity -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] Disables assertions with the specified granularity -esa | -enablesystemassertions Enable system assertion -dsa | -disablesystemassertions Disable system assertion -agentlib:<libname>[=<option>] Load native agent Library <libname>, for example -agentlib:hprof See also -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<option>] Load native agent library by full pathname -javaagent:<jarpath>[=<option>] load Java Programming language agent, see also java.lang.instrument -splash:<imagepath> Displays the startup screen using the specified image For more information, see also http://www.oracle.com/technetwork/java/javase/documentation/index.html. wangyanfei@wangyanfeideMBP ~ % java -version java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode) wangyanfei@wangyanfeideMBP ~ % javac usage: javac <options> <source files> among, Possible options include: -g Generate all debugging information -g:none No debug information is generated -g:{lines,vars,source} Only some debugging information is generated -nowarn No warnings are generated -verbose Outputs a message about what the compiler is doing -deprecation Output using obsolete API Source location of -classpath <route> Specifies where to find user class files and comment handlers -cp <route> The location of the user specified file and comment handler -sourcepath <route> Specifies where to find the input source file -bootclasspath <route> Overwrite the location of the boot class file -extdirs <catalogue> Overwrite the location of installed extensions -endorseddirs <catalogue> The location of the standard path that overrides the signature -proc:{none,only} Controls whether annotation processing and/Or compile. -processor <class1>[,<class2>,<class3>...] The name of the annotation handler to run; Bypass the default search process -processorpath <route> Specifies where to find the comment handler -parameters Generate metadata for reflection of method parameters -d <catalogue> Specify where to place the generated class file -s <catalogue> Specify where to place the generated source file -h <catalogue> Specifies where to place the generated native header file -implicit:{none,class} Specifies whether to generate class files for implicitly referenced files -encoding <code> Specifies the character encoding used by the source file -source <Distribution> Provides source compatibility with the specified distribution -target <Distribution> Generate specific VM Version of class file -profile <configuration file> Make sure you use API Available in the specified profile -version Version information -help Output a feed of standard options -A keyword[=value] Options passed to comment handler -X Output a feed of nonstandard options -J<sign> Directly <sign> Pass to runtime system -Werror Terminate compilation on warning @<file name> Read options and filename from file
The output is normal.
If you are using Mac for the first time, please remember this file ~ / bash_profile is very important. In the later system installation, the middle price needs to be configured here, such as(
maven, HomeBrew, mysql, tomcat, jmeter, RabbitMQ Config, etc.).
summary
It's OK to follow the process. If there's any problem, please send me a private letter.
When writing the next article, I decided to sort out some skills of using Mac synchronously (only those used in my current work are practical. If they are too comprehensive, I feel useless. Time is limited. Move bricks and continue).