Skip to main content



      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 12:31 Go to next message
Eclipse UserFriend

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!

[Updated on: Tue, 02 December 2014 12:33] by 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 13:29 Go to previous messageGo to next message
Eclipse UserFriend
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 13:30] by 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 14:10 Go to previous message
Eclipse UserFriend
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.

[Updated on: Tue, 02 December 2014 14:11] by Moderator

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


Current Time: Fri Jul 25 21:07:13 EDT 2025

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

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

Back to the top