0

I'm using IntelliJ IDEA 2021.3.3 (Community Edition) , I upgraded it to the latest verion and since then I'm facing this error even when I downgraded it.
Any project I make runs fine inside the IDE but the jar file built using build artifacts never runs from cmd, shows this error
Error: Could not find or load main class E:\HelloWorld\out\artifacts\HelloWorld_jar\HelloWorld.jar Caused by: java.lang.ClassNotFoundException
I tried the solutions at this answer but nothing seems to work.

here is the jar file: https://www.dropbox.com/s/raw/1p2inr054qsjhcs/HelloWorld.jar
(scanned by VirusTotal , or run the jar online in this Colab notebook )

and the project folder zipped : https://www.dropbox.com/s/raw/wzxz0z48x1shkyk/HelloWorld.zip (scan VirusTotal)

enter image description here

yazan sayed
  • 777
  • 7
  • 24
  • 1
    How do you run the jar from the command line? It works fine for me if I launch it as follows: `java -jar HelloWorld.jar` Try to delete `build/out/.gradle` directories and rebuild your project from scratch using `Build | Build Artifacts... | Build` – Egor Klepikov Oct 06 '22 at 06:44
  • OMG the time i wasted yesterday, thanks alot, '-jar' was the cause , should I delete the question ? or close it – yazan sayed Oct 06 '22 at 07:09

0 Answers0