Couldn't find or load main class when running jar file

Phill Alexakis :

I know this is a common issue, but i've tried many things to make this work.

Main Class name: Test

I've included a MANIFEST.MF with Main-Class attribute, as follows:

  1. Main-Class: src.client.Test
  2. Main-Class: classes.client.Test
  3. Main-Class: client.Test
  4. Main-Class: Test

None of the above worked.(the jar is located in the deploy dir )

This is the contents of my project: enter image description here

On my deployment profile i have included:

  1. MANIFEST.MF
  2. lib directory
  3. All the merged content of the file's group contributor (Test.class , an external jar that i'm using )

Note: I'm using JDeveloper 12c IDE


Related posts i've tried but i couldn't make it work:

Could not find or load main class with a Jar File

Cannot run jar file: Could not find or load main class Hello

Phill Alexakis :

I mentioned correctly the Main-Class attribute, although the Class-Path was wrong.


The structure of the .jar file is the following:

myjar/client/Test.class

myjar/META-INF/MANIFEST.MF

myjar/myexternal.jar


I Had to mention myexternal.jar in my MANIFEST.MF as follows:

Correct: Class-Path: ../myexternal.jar

Wrong : Class-Path: myexternal.jar

I don't know if that is making any sense, i shouldn't get an exception loading the main class because of the wrong way of mentioning myexternal.jar

Nevertheless this fixed it!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=322012&siteId=1