Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Helpful ways of having one project use the classes/jars of another
Helpful ways of having one project use the classes/jars of another [message #1495982] Tue, 02 December 2014 17:31 Go to next message
tgm 1024 is currently offline tgm 1024Friend
Messages: 8
Registered: November 2014
Junior Member

Using eclipse/luna.

Ok, for some reason, this seems much harder for me to figure out in Eclipse than in any of the other java IDE's I've played with over the years since VisualCafe in the 90's. I must be misreading something in the settings.

For this example, let's say I have one project dedicated to making common code usable by multiple projects. Let's call that project "Common", and it consists of two packages:
aaa.bbb.common.one and aaa.bbb.common.two
each with some number of classes each.

I have another project called "Project1", and another called "Project2", both of which use the classes created in project "Common".

1. How do I get the project "Common" to create a jar file such that I can use it in other projects?

2. How do I get Project1 to simply reference the location of the Common project so that all classes created by Common are immediately accessible?

3. Having accomplished #1 above, can I have a single project create two distinct jars (for each of the two packages)?

In a non-IDE evironment (editor + commandline) I would be modifying the classpath and either hand-creating the jars, or using a makefile. But in eclipse, what are the cleanest and simplest ways of doing #1 and #2 above?

Thanks!


No, synchronized method declarations will not get you out of this newbie multithreading pitfall:
thing.set(thing.get() + 1);

[Updated on: Tue, 02 December 2014 17:33]

Report message to a moderator

Re: Helpful ways of having one project use the classes/jars of another [message #1496033 is a reply to message #1495982] Tue, 02 December 2014 18:29 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
1. see http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-32.htm&cp=1_3_1

2. In project1's properties, find the Build Path page, select tab "Projects" and add project Common.
- this does not require step 1.

3. is included in the solution for 1.

HTH,
Stephan

[Updated on: Tue, 02 December 2014 18:30]

Report message to a moderator

Re: Helpful ways of having one project use the classes/jars of another [message #1496072 is a reply to message #1496033] Tue, 02 December 2014 19:10 Go to previous message
tgm 1024 is currently offline tgm 1024Friend
Messages: 8
Registered: November 2014
Junior Member
Stephan Herrmann wrote on Tue, 02 December 2014 13:29
2. In project1's properties, find the Build Path page, select tab "Projects" and add project Common.
- this does not require step 1.



Ok, thanks. Regarding #2 above though, I think I discovered the problem I've encountered.

The "required" project (Common) must be open in order for me to add it. Or I get the following tab (with no way to add):

index.php/fa/20107/0/

And even after I add it, if I close the dependency project Common, then it can't be used in its build. This is counter-intuitive to me.


No, synchronized method declarations will not get you out of this newbie multithreading pitfall:
thing.set(thing.get() + 1);

[Updated on: Tue, 02 December 2014 19:11]

Report message to a moderator

Previous Topic:Logs and add ons
Next Topic:Hi guys need help with Trapezoidal Rule Java code
Goto Forum:
  


Current Time: Thu Mar 28 14:35:29 GMT 2024

Powered by FUDForum. Page generated in 0.02551 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top