Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make NetBeans(ant) generate multiple jar files for one project

Tags:

java

jar

netbeans

i have a project in netbeans that include two main classes, one starts a client and other starts a server.

I need to create two jar file to wrap into two exe file, one for client and one for server, how can i do this?

Thanks.

NB: im using ant.

like image 382
blow Avatar asked Jan 22 '11 13:01

blow


People also ask

How do I add a jar file to Netbeans 13?

Right-click the Libraries node and choose "Add JAR/Folder".


1 Answers

You have two options:

First, you can overwrite the NetBeans ant target in the project's build.xml in order to create your two jar files.
How you can do this, is explained in the online help of NetBeans. The chapter is named "Customizing the IDE-Generated Ant Script

But I would recommend to create different projects for each "executable".

Most probably server and client are using some common code, so you'll wind up with three different projects in NetBeans:

  1. MyApp Common - contains all classes that are used by server and client
  2. MyApp Server - contains everything that you need for the server, includes the project "MyApp Common" as a library
  3. MyApp Client - contains everything that you need for the client, includes the project "MyApp Common" as a library.

Then when you build the client or server project, each will generate a separate jar file.

like image 75
a_horse_with_no_name Avatar answered Oct 13 '22 19:10

a_horse_with_no_name