When I build my project (using the Netbeans IDE) will it only take the main class, or will it include the other classes in the project even though they are not explicitly declared within the code for the main class?
All classes in a package are included in a jar file. You can cross-check it by following this:
Go to dist folder of the project.
Extract the jar file with any file archiver(eg: 7-zip, winrar, winzip).
The extracted folder contains all the contents that are included in a jar file.
Example:
Test is a main class
Test.java:
package test;
public class Test
{
public static void main(String[] args) {
// TODO code application logic here
}
}
There is another class: class1
class1.java:
package test;
public class class1
{
}
class1.java is not explicitly declared within the code for the main class(Test).But when I build this project in a Net-beans IDE and extracted the jar file(Test.jar).The jar contains:
class1.class Test.classIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With