Adding a java file to a jar results in a space in front of the path.
If you create a jar (by creating a zip and renaming it) and then drop a java source file into it, the directory structure according to the java source file is being created inside the archive. However, the path is prepended with a space which should not be there.
- Create a new zip archive with any file in it.
- Rename it from "file.zip" to "file.jar".
- Grab a java file (for example this one) and drag it into the archive.
- The folder structure according to the java package of the source file has been created ("org/bonsaimind/jmathpaper/Main.java").
Trying to delete or edit the file will be met with an error message. When listing the files with unzip -l file.jar
we find the following output:
Archive: file.jar
Length Date Time Name
--------- ---------- ----- ----
2105 2019-04-22 13:26 overlord.text
6228 2019-08-29 21:40 org/bonsaimind/jmathpaper/Main.java
--------- -------
8333 2 files
You can clearly see that a space has been added to the directory structure.
What is even more confusing, is that any leading space is ignored by file-roller. So we can have a file like this:
Archive: file.jar
Length Date Time Name
--------- ---------- ----- ----
2105 2019-04-22 13:26 overlord.text
6228 2019-08-29 21:40 org/bonsaimind/jmathpaper/AnotherFile.java
6228 2019-08-29 21:40 org/bonsaimind/jmathpaper/Main.java
--------- -------
8333 2 files
And file-roller will display it as one "org" directory.
There's mate-desktop/engrampa#291 which is about the same bug in Engrampa.