Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Linking java files
Linking java files [message #1799883] Sun, 16 December 2018 19:03 Go to next message
SkytAsul . is currently offline SkytAsul .Friend
Messages: 1
Registered: December 2018
Location: Rennes, France
Junior Member
Hello,

I will describe you my situation :

I have 3 different projects in my workspace, and in these 3 projects I have 3 times the same class, with same methods, etc. Problem is, when I want to edit something in one project, I would like that it's edited too in the 2 other projects.
I tried to create another Java Project with only this class inside, and then link the file in the projects via New > File > Advanced > choose the file path. Problem : package are not same in all projects, so the package declaration throw an error.
If I try to link the source folder, I will not be able to choose where I want theses classes to be (in what package). Same problem with "required project" option.

So, my final question is : is it possible to link the same class in different projects and to choose in what package there will be ?

Thank you
Re: Linking java files [message #1799920 is a reply to message #1799883] Mon, 17 December 2018 13:40 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You might as well ask if you can have three bank accounts so that whenever you make a deposit to one your balance improves in all three.

If you want re-use, re-use, probably by inheritance, perhaps by a shared library. Else if what you want is really what you want create a build script that copies a master to two slaves.

Regards

Ed Willink
Previous Topic:Launch config "Error: Could not find or load main class"; class is in a dependent mvn proj
Next Topic:Annotation processing with Java 11 Support Plug-in
Goto Forum:
  


Current Time: Thu Apr 25 03:41:36 GMT 2024

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

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

Back to the top