Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
run jar with `Error: Could not find or load main class`

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: enter image description here

How do I solve this problem? Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!