Combining Jar file with -classpath JAVA

前端 未结 2 930
情深已故
情深已故 2021-01-17 03:01

I have a question regarding compiling a class which has some dependent classes in a Jar file (MyJar.jar). By putting a directory tree in a -classpath option (ex

2条回答
  •  余生分开走
    2021-01-17 03:40

    If your directory tree represents packages, then all your classes will be loaded and usable.

    For example, the following class:

    package my.company.project;
    
    public class MyClass {
        public static void main(String[] args) {}
    }
    

    Should be inside the folder my/company/project to be usable.

提交回复
热议问题