views:

1202

answers:

2

I have just started playing with Java, and I really like the language. I am using the NetBeans IDE, and I find one odd oversight. I can create a new class in a project, but NetBeans doesn't appear to support any way to import an existing class into a project.

I manage to get it done by going to some other project where the desired class already occurs, and then I copy/paste it into the source code folder of the new project, then change the package name at the top of the pasted file to match the package name of the new project.

Is there a nice direct way to do this from the NetBeans interface?

Thanks for any help on this.

+2  A: 

In the Projects window you can expand the project that you are working on. Right Click on Libraries and select Add Project.... You will get a dialog allowing you to select another Netbeans Project with the Java classes that you wish to use.

Vincent Ramdhanie
A: 

When you build the java project in netbeans it creates a jar file on the dist folder in the current project directory. You can use this jar file for the other project as a package by adding this as ADD jar in the next project.I have tried this ,i am using my old project jar file for new project development.

prakash.panjwani