deanTheBean
deanTheBean

Reputation: 47

How to create my own utility classes in Eclipse?

I'm a student, so please bear with me!

I've got some introductory Java (using BlueJ) but I'm taking a Java course and using Eclipse. I'm working on my homework, and each week's lab builds on the previous week. I'm finding that it would be useful to create a couple of my own utility classes that I can import into my lab projects, rather than having the same classes coded into every project.

I can't figure out how to do this correctly, however. In my project's build path I've used the "link source" function to point to the project folder where my utility class lives, but I still get a message from Eclipse that it can't resolve the import.

Can someone point me in the right direction? I've reviewed the answers to similar questions but no joy.

Thanks, dean

Upvotes: 0

Views: 2553

Answers (1)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81684

You can create multiple projects in Eclipse. Put your utility classes into one project. Then when you create a new project for an assignment, add the utility project to the "Java Build Path" (right-click the project, choose "Properties".) The assignment classes will then have the utility classes available.

Upvotes: 1

Related Questions