I create jar file by Intellij by these steps: File -> Project Structure -> Project Settings -> Artifacts -> Click green plus sign -> Jar -> From modules with dependencies
I run it by java -jar XX.jar, but I get an error: Error: Could not find or load main class com.guangyan.upf.Main
there is my jar file look like:

How do I solve this problem? Thanks in advance!
When creating the jar artifact make sure you have specified the directory for manifest file. Then add the main class in manifest:
Manifest-Version: 1.0
Main-Class: sample.Main
Or else you can follow this tutorial for how to create runnable jar artifact and run it using Gradle in IntelliJ IDEA.