Java SDK Download:
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Default installation path: C:\Program Files\java
Add environment variables for Java and javac, path: C:\Program files\java\jdk1.8.0_101\bin
Compile Java command: javac-d java file path (will generate a. class file with the same name)
Run Java command: Java javaclass file path
Basic Java Program rules:
- Java program must take the main method as the entry point, all main methods are: public static void Main (string[] args) fixed
- Java program One source file can only have a public class, can have more than one class file (non-public)
- Java files are named in the same class name as public
Problems:
- After Java 1.5 can not set classpath, if you want to set classpath, do not forget to add (.) Force Java to compile the program under the current path
- Capitalization issues. Java is case-sensitive Hello and hello are different
- The path contains spaces, the installation of the Java SDK is best installed in a folder without spaces (the default C:\Program Files are spaces, may cause problems)
- Main method if you want to run a Java program directly with the Java command, there must be a main method, and this method must be written as public static void main (string[] args)
One of the Java Learning Essays: A Java language overview and development environment