IDEA running a single Java file

For some Java examples may be only a single file, not a complete Java project, so how do you want to run a single Java file, for example with IDEA.

My environment:

  • IDEA 2017.3.2
  • jdk 1.8.0.73

Steps:

1. Install jdk environment, the current version of jdk1.7,1.8 will automatically configure the environment variables

2. Open an existing java folder where the file or create a java project, dragged into a single file

3. If it is an existing folder, right - the root - Set Source Directory

5. In the Explorer window, select a single java file, right click and choose Run xxx.main

Other: If you run prompted to set outpath, set in the project setting outpath, set the folder \ out

image

Guess you like

Origin www.cnblogs.com/zhaoqingqing/p/11847791.html