Q#10 Lab - Java Build & Packaging

Can you please provide further clarification and the correct entry to input for the above question. Asks for the output created when run the maven package. Tried command, did not work. Also tried: cat /opt/maven/my-app/target/my-app-1.0-SNAPSHOT.jar. Last question in lab. thank you

Kindly provide me with the exact steps you did and what the error message you get.

Hi, I request some clarification on Q.10 of the Java Build & Packaging Lab.

First tried to run the using: java -jar - but it didn’t work. ==>
thor@host01 /opt/maven/my-app/target$ java -jar my-app-1.0-SNAPSHOT.jar
no main manifest attribute, in my-app-1.0-SNAPSHOT.jar

Can someone please explain why this is so?


Secondly looked at the hint ==> java -cp
/opt/maven/my-app/target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

Could you please explain this command e.g. what is meant by -cp and why do we give the last part of the command?

Thanks a lot! @Ayman

1 Like

Hi @Ayman, can you explain to me the syntax meaning, please?

It’s in Q#10 Lab - Java Build & Packaging

@IChatterjee , @louisnguyen012z , java tells the command line to execute java.exe.

-cp is an option that you feed to java.exe. It tells the JVM that you want to use a custom classpath, specified by the next command-line argument.

com.mycompany.app.App - it is the path to the package. You can check this using the command cd /opt/maven/my-app/;tree

1 Like

Thank @tgp for your reply, also I want to ask that the package is .jar so why we don’t run jar command for the output of the file.

@louisnguyen012z
jar means (java archive) this is the extension for the file generated by java command.