How to compile and run with this folder structure

前端 未结 2 2037
闹比i
闹比i 2020-12-07 00:29

I have my java source files in src/net/... folders and .jar files in lib folder. How to compile and run this files with command line without writing build script ?

2条回答
  •  难免孤独
    2020-12-07 00:49

    Try this

    javac -cp .;lib/lib1.jar;lib/lib2.jar src/net/*.java
    

    lib1 and lib2 are your libraries. It assume your libraries are in lib folder. You may also need to change the destination folder for .class files.

    To run the application use

    java -cp bin;lib/lib1.jar;lib/lib2.jar net.mypackage.MyMainclass
    

    net...

    It assume your .class files are in bin folder.

提交回复
热议问题