cd "$(dirname "$0")"
javac -d . -sourcepath Source Source/project/Main.java
rm "Project.jar" 2>"/dev/null"
jar cfm "Project.jar" "Manifest.txt" project/*
This script would be placed in a Project directory, in which is Manifest.txt
and a Source
directory which contains the base package, i.e., Main.java
would start with package project;
.
The script would compile the Java into classes, creating a directory of name project
inside the Project directory, and then from the class files create Project.jar
. I do not have any IDEs installed, but is this typically how they work to compile a project with multiple .java
files into a single .jar
file?