opt-nc / j7zip

Java 8 Command line tool to compress / decompress files using LZMA algortihm (like 7-Zip for .7z) with password protection
GNU General Public License v3.0
1 stars 0 forks source link

:zap: Cannot make jar executable (cannot execute binary file: Exec format error) #14

Closed adriens closed 1 year ago

adriens commented 1 year ago

:grey_question: Context

I need to make the jar executable but I cannot achieve this.

Here are the steps to reproduce :

export J7ZIP_VERSION=v1.0.0
curl -LO https://github.com/opt-nc/j7zip/releases/download/$J7ZIP_VERSION/j7zip.jar
chmod +x j7zip.jar
./j7zip.jar
java -jar j7zip.jar

image

:dart: Action

Please let me know what should be done to make it possible to run the jar without having to call java -jar... or if not possible provide a j7zip.sh in the repo that I could make executable.

adriens commented 1 year ago

I'm preparing a dumb .sh that does the job

Dougniel commented 1 year ago

Maybe I didn't understand you request, but a JAR cannot be executed directly without java

adriens commented 1 year ago

I meant the following thing(assuming we have a java runtime properly set)

chmod u+x hello.jar
./hello.jar

:information_source: Sometimes we use it on Spring Boot

Dougniel commented 1 year ago

I meant the following thing(assuming we have a java runtime properly set)

The purpose of this documentation is to explain how to make an executable JAR versus a lib JAR (with MANIFEST.MF)

ℹ️ Sometimes we use it on Spring Boot

Never seen that before, you need `java -jar ..'. Do you have some example ?

adriens commented 1 year ago

:point_down:

Dougniel commented 1 year ago

👇

Have you tested it ?

Look at the docs please : https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#goals-repackage

image

adriens commented 1 year ago

We'll talk about this at our SCRUM this afternoon.

adriens commented 1 year ago

As discuused today. Abandonned because too much OS specfic