Java war file wrongly (?) detected as an invalid zip file - linux

To do a test, I have to add a jar file into a Java war file I've created with Maven. The war file works itself fine.
To insert my lz4-java-1.6.0.jar into application-metier-et-gestion.war on internal zip folder /WEB-INF/lib, I use this command :
zip -b WEB-INF/lib application-metier-et-gestion.war lz4-java-1.6.0.jar
But I receive that error message :
zip warning: expected 354 entries but found 84
zip error: Zip file structure invalid (application-metier-et-gestion.war)
I can do and redo mvn clean install it will always create a runnable war that seems perfect to me, but that zip declares invalid. Who is wrong ?
I case zip would be going wrong, what is the workaround to do what I want ? Is there a way through another tool ? tar ?
I case Maven would be going wrong and create a bad war file each time, how to detect the part it is creating wrongly ?

right click the war file ,rename the file extension war into zip
example :
test.war -> test.zip

As far as I can see you tried to add an additional library to the archive.
JAR files and WAR files are plain ZIP files. There is only one rule you have to obey, library files must not be compressed.
If you want to add JAR files to a JAR or WAR file, disable compression for the specific file to be added.

Related

How do I access the directory of my NSIS Installer inside a Zip File to extract that Zip File?

I want to extract a ZIP File with the .exe inside.
I want to execute the .exe inside the Zip to extract the Zip File.
Already tried it by executing: ZipDLL::extractall "$EXEDIR" "$DESTINATION"
I think that does not work, cause the .exe is stored in the TEMP Folder when opened, so it cannot find the.Zip file
So how do I extract that Zip when executing the .exe from inside the Zip?
Thanks for answers!
Your question does not make a lot of sense, you should just put the files inside the installer and not have a zip file at all.
Even if it made sense, it is not possible because where a exe is executed from when you double click it inside a zip file depends on the zip program you are using and there is no way of getting the path of the zip it was extracted from.
If for some reason you want to be able to update the files inside the zip file without rebuilding the installer you can use a cab file instead. The CabX plug-in supports extracting from cab files appended to the installer exe.

Groovy: How to convert .groovy to .exe

Please, provide simplest way to convert .groovy-script to executable file .exe for windows-platform or .jar, for using on multiply platforms.
Thanks
Jar
This project is a simple card game, written in Groovy. It is uses a Gradle script to build a zip file that can be executed like so:
unzip warO.zip
java -jar warO.jar
See this segment of the build.gradle file to see how the manifest is specified for the jar (i.e. the classpath, main class entry point, etc):
jar.archiveName 'warO.jar'
jar.manifest {
attributes 'Main-Class' : 'net.codetojoy.waro.Main'
attributes 'Class-Path' : 'jars/groovy-all-1.6.4.jar jars/guava-collections-r03.jar jars/guava-base-r03.jar'
}
Exe
For an exe, consider a tool such as JWrapper.

trouble creating an axis 2 .aar file: xml/services not found error

I am trying to create an aar file using OSX 10.7.5 (as a part of this tutorial). To generate the .aar, I navigate to the directory holding my webservice in my eclipse workspace and type
jar cvf FirstWebService.aar ./*
This is the command that Apache says to use to generate the aar in their Code Listing 9 from the apache axis 2 documentation.
The command creates an.aar -- but something is wrong with the process that I am using to create the .aar because when I go to load the .aar file into tomcat's /webapps I get an .xml/services not found error.
I am not sure what to do to fix this error. If I search my computer's file system for the services.xml file, I can find it in /path to eclipse workspace/workspace/MyFirstWebService/WebContent/WEB-INF/services/FirstWebService/META-INF
but I am not sure if this file is supposed to be rolled in to the .aar file somehow or if I can just manually plunk this file somewhere into the apache directory structure to get the thing to run.
Note: I do not think I am manually unzipping or unpacking the aar like in this question. Axis2 web service error: services.xml not found I am just running the command listed above from the apache documentation.
Here is the .aar file
note I am using all of the same versions of the software as in the tutorial -- but I am using OSX 10.7.5 where they use windows in the tutorial. Accordingly, I have changed the make-aar command for windows shown in the tutorial (jar cvf FirstWebService.aar com META-INF) into the one shown above. If I just try to run the command from the tutorial jar cvf FirstWebService.aar com META-INF I get the same xml/services not found error. It gives this output in the terminal...
com: no such file or directory
META-INF: no such file or directory
added manifest
I found the issue. When you type the command to create the aar file you have to be in the directory .../EclipseWorkspace/EclipseProjectName/WebContent/WEB-INF/services. This directory contains /META-INF/services.xml. The process that makes the .aar file must be looking in this folder.

How to put a JAR file in a Play 2 project and use it?

In Play 1, we can put some JAR files into the /lib directory. But there is no such a directory, and I don't find any information to do this.
Play 2 uses repositories, but sometimes I just want a quick and dirty way to use a JAR file. How do I do that?
Since Play 2 applications are built using sbt, you can just follow their convention for unmanaged dependencies: put your JAR file in the lib/ directory.

jd-gui stops working when I try to save all resources

I opened a jar file in jd-gui but when I try to save the all resources it stops working. I don't know where to look for the logs of jd-gui.
How can I save all the decompiled source files?
I met the same problem, and resoled it as below:
unzip the target jar file.
remove unnecessary folder
zip the remaining class files into a new-small jar file.
download the jd-cli project from here: https://github.com/kwart/jd-cli/releases/tag/jd-cli-1.2.0
use jd-cli to de-compile the jar , and with the log option, e.g.
jd-cli target.jar -od jar_result -g ALL
check the output log and find out which block.class file block the de-compile proccess. if there is, then remove it from the target.jar and then re-run the jd-cli again. You can manually copy/paste the block.class source code from jd-gui.
Open "jd-gui.cfg" with a text editor. "LastUri", in section "Decompilation", contains the name of the CLASS file causing the crash. A workaround is to open the JAR file and remove or change extension of this CLASS file.
Regards.
It seems a bug. I solved it simply trying to export sources to other folder ($home -using debian-)

Resources