Shared resources in a Java project for server and client packages

后端 未结 4 1106
伪装坚强ぢ
伪装坚强ぢ 2021-01-15 10:14

I have a Java project that has both server and client packages. In addition I have a library package.

I use eclipse and have put everything in a single Java proje

4条回答
  •  温柔的废话
    2021-01-15 10:41

    You can have a separate project for your shared code, and create a library (i.e. jar file) for that. Then, your client and server projects can both use the shared library.

    Even better, you can use this shared library for other projects in the future.

    Note: Eclipse is just going to compile the source files into their respective class files and put then in the bin folder, or wherever you have your output folder set for the project properties. It doesn't create a jar file by default.

    If you want to create jar files, the best way is to use a tool like ant. Then you would be able to create whatever jars you need, and structure it however you like.

    Here's a link for reference: Create Multiple JARs from Eclipse Project

提交回复
热议问题