Error running . jar on Windows Powershell with Maven

Asked

Viewed 517 times

2

Good afternoon to all.

I am trying to run this tool (CPA - https://github.com/CityPulse/cpa). Through the link provided, I download the classes. After that, I run Maven, which generates a .jar. The configuration file (pom.xml) used in Maven is this one: https://github.com/CityPulse/cpa/blob/master/pom.xml

After installing Maven, it generates the "target" folder with the above mentioned . jar. When trying to run this . jar, the problem starts.

In all my attempts, I have received the following error:

"Erro: Não foi possível localizar nem carregar a classe principal com.ericsson.research.iot.citypulse.CityPulseInterface"

This is the command I’ve been running:

.\java -jar C:\Users\Vinicius\Documents\GitHub\cpa\apache-maven-3.3.9\bin\target\cpa-1.0-SNAPSHOT-jar-with-dependencies.jar

The MANIFEST.MF file looks like this:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: Vinicius
Build-Jdk: 1.8.0_73
Main-Class: com.ericsson.research.iot.citypulse.CityPulseInterface

My class directory and the location where . jar:

JAR: C:\Users\Vinicius\Documents\GitHub\cpa\apache-maven-3.3.9\bin\target

Classe: C:\Users\Vinicius\Documents\GitHub\cpa\apache-maven-3.3.9\bin\target\src\main\java\com\ericsson\research\iot\citypulse

I made several changes to the directory level, including . jar in the same of the classes (inside the package), but the error continued.

Note: JAVA_HOME and PATH are already configured. I use Windows 10.

Can you help me?

1 answer

0

Open your jar with Winrar or some type code decompiler Jd-Gui and make sure the class is in the generated jar. If not, you have the wrong Maven settings.

  • Hi Ernando, I unpacked it and as I mentioned, the jar’s MANIFEST.MF, contained Main-Class: com.ericsson.research.iot.citypulse.CityPulseInterface. See it complete in the question.

  • This I saw, what I’m talking about is for you to check if Citypulseinterface.class is inside the jar, in MANIFEST I know it is. This error is because it is not finding the class inside the jar in this repository "with/Ericsson/research/Iot/citypulse/class/Citypulseinterface.class"

  • Oh yes, I understand! I’m sorry. So, the classes are not inside. I am trying to use this tool: https://github.com/CityPulse/cpa. The classes are downloaded from there, and the jar "Cpa-1.0-SNAPSHOT-jar-with-dependencies.jar" is created with the installation of Maven. From the . mvn install command, the target directory was created with this .jar. Should the generation of this . jar encapsulate these classes? I will complete the initial question by including the Pom.xml file used by Maven.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.