I'm playing around with javac
+ java
+ java -jar
to get more involved with modules.
I'm using latest JDK 14.
I have this simple class:
package defaultpackage;
public class Main{
public static final void main(final String args[]){
System.out.println("HI WITH: "+java.util.Arrays.toString(args));
}
}
I create the directories without problems:
javac -d . Main.java
Later on I can create the jar file playing mixing some values like this:
jar --create --file Jar.jar -e defaultpackage.Main defaultpackage
jar -cfe Jar.jar defaultpackage.Main defaultpackage
jar cfe Jar.jar defaultpackage.Main defaultpackage
They all create the jar with the class in the manifest file and I could run it with this simple command:
java -jar Jar.jar
But I could not this command to work is a slightly different of the previous perhaps this couldn't be mixed but i thought it could:
jar -cf Jar.jar -e defaultpackage.Main defaultpackage
I'm trying to said well create the Jar.jar file with the entry point defaultpackage.Main
But states.
jar -cf Jar.jar -e defaultpackage.Main defaultpackage
-e : no such file or directory
defaultpackage.Main : no such file or directory
I have try this as well but with the same response:
jar -cf Jar.jar defaultpackage -e defaultpackage.Main
And:
jar -cf Jar.jar -e defaultpackage/Main.class defaultpackage
But also with the same response.
How can I make this command to work? I could not mix -cf
plus -e
?
I could not mix
-cf
plus-e
?
Correct. The options are somewhat like those of the venerable Unix tar command, but not exactly the same. You cannot use both combined letters and separate option letters.