3

I have a class Utilities.java that I'd like to turn into a library that I can include in subsequent projects.

I did New project, Java class library and named the class Utilities and put it into the C:\Users\Dov\Google Drive\NetBeansProjects\Utilities folder.

In a new project, I tried to add the library via Libraries, Add jar/folder and gave the name C:\Users\Dov\Google Drive\NetBeansProjects\Utilities\dist\Utilities.jar, so under Libraries I then had JDK 1.8 and Utilities.jar.

But I got errors (cannot find symbol) on all attempts to use methods in Utilities.jar.

What should I have done?

2
  • 1.) Are you using imports for your Class </br>2.) Is your class and method PUBLIC? </br> 3.) Open up your jar file with a compression utility like WinRar and see if class is there? If yes then in correct package structure? Commented Aug 3, 2015 at 16:44
  • Refer to my Answer below. Not sure what was wrong with original approach, but I'm OK. So, yes, I was using imports of public classes. Commented Aug 3, 2015 at 20:35

1 Answer 1

1

OK. I deleted Utilities.jar from the Libraries folder, then right-clicked Libraries and this time selected Add library..., which opened dialog in which I clicked Create library.

I gave the new library the name Utilties and clicked Add jar/folder,then gave path to jar file: C:\Users\Dov\Google Drive\NetBeansProjects\Utilities\dist\Utilities.jar. Now I have in the Libraries folder a library named Utilities - Utilities.jar and all is well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.