2018-03-06
Running Java programs in eclipse
Step 1:
Open Java File
Open the Java file created in the command line Hello World directly: Helloworld.java
Step 2:
Run
Click the Green Run button to run directly
In Eclipse, the compilation process automatically executes the
Step 3:
Observing running results
Once the operation is successful, the console console interface will appear below
If the console console window cannot be found, use the following procedure to open the console window
Step 4:
Open the Console window
By default, the console window is open, and if you accidentally close it, you can open it in the following way:
menu, Window, Console, Show View
Problem
Sometimes there are problems, there are hello this class, and there is the main method, but the run will appear to be unable to find or load class Hello, or Class not Found exception.
This situation, there are many reasons, please follow the following method one by one troubleshooting
Cause 1-check automatically
Eclipse is automatically compiled after saving, but is built on the premise of a setting:
Menu-project-> Tick build automatically, if not checked, it will not automatically compile Hello.java into Hello.class
Reason 2-problems
Menu->window->show view->problems Show Problems page
This will show the current project error, and the project will not automatically compile the. java file if there is an error.
The error is that the package imported by the project does not exist and the practice of importing the package is as follows: Importing MYSQL-JDBC jar packages for projects
Java Basics/Lesson Fourth: Running the first Java program in Eclipse and the problem of not finding a class