1

My question is kind of simple, and actually I'm feeling a bit dumb for asking this...

I'm using Eclipse IDE and I have 2 projects: MarketServer and MarketClient (I'm working with TCP connecting and sockets).

I've created a class called Costumer, which I need in both projects, in the same package of MarketServer (and inside the same project). How can I let both projects knowing that class? Do I have to create a isolated package just for Costumer and then import into both projects? How do I do that?

EDIT: Where do I place the new package that contains Costumer?

Sorry about my english, but I've tried my best :(

Quik19
  • 352
  • 3
  • 13

2 Answers2

1

The exact steps vary depending on what IDE you're using, but here's the basic idea: you need to create a separate project with the Customer class and whatever classes are shared between your MarketServer and MarketClient projects. That separate project needs to be compiled into a library, and then you can either manually (using the tools your IDE provides) or automatically (using a build tool like Maven) set up dependencies in your MarketServer and MarketClient projects that point to that new library.

Sam Estep
  • 12,974
  • 2
  • 37
  • 75
0

Create a jar(or zip of src folder) of source project where your original class is there.. and add this jar in other project. But this way whenever you change source class, you need to previous step (creating jar/zip) again.

Or else, use ant or maven script, which will do earlier mentioned steps for you automatically whenever you build(compile) your source project.

Raman Shrivastava
  • 2,923
  • 15
  • 26