So I’m developing an encrypted chat server, and in the Eclipse project I have them both in the same project, the server and client files are in their respective packages.
For example, server files are in a package like org.mysite.server and client classes are in org.mysite.client.
I have them all in the same project since a lot of the decryption/encryption use the same classes and methods.
How can I make builds (JARs) only containing the certain packages for either the server or client with Eclipse?
I would create separate projects for them anyway. You can put the common classes into a third “common” or “shared” project and add it as a dependency to both the server and client project. This has the advantage that it is well supported and natural in build tools like Maven.
However, if you’d rather have everything in the same project, you may choose the files, packages and classes that go into a JAR in the JAR Export dialog of Eclipse: File -> Export -> Java -> Jar File when it say “Select the resources to export”.