Netbeans - Add library that is currently being edited - java

I'm working with multiple related projects in Netbeans. Is is possible to add a library or reference to that library (made from building one of the projects) to the other projects, while I'm still editing that library? I can 'clean & build' that library everytime I edit it and then import it again to the other projects, but that would be a really tedious task. Is there a way I can do it conveniently in Netbeans? Thanks!

In the project properties -> libraries you can specify Jar/Folder, libraries or other projects. All changes in the pointing project will be available in your current project as you change it.
You still need to build it, but you don't need to import as Jar again.

When you right click on the library group in your project you can add another project as a library.

Related

I’m Using NetBeans 11. But there is no Libraries category in the tree

In order to follow a tutorial, I need to edit my Libraries settings. However when I right click my project and click properties, there is no Libraries category in the tree. I have done a bunch of searching and the results tell me that it just should be there by default.And I know that I want to import the dependencies to the relevant dependency folder in the tree. How can i do it?
Please what kind of project did you create? specifically the build system. The build system describes what tool NetBeans will use to manage(compiling & creating the jar file) your project.
The library menu appears when your project is based on ANT.
If the above is not helpful, kindly reply and describe the steps used in creating the project.
Dependencies to the relevant dependency folder can ad by using pom.xml. just open the website mvnrepository.com and find the groupId,artifactId and version that jar file. then add it to pom file and compile.

Using Workspace for different projects

My new job requires to work with eclipse and the IDE works well so far. But there's one thing I couldn't manage / understand. I am used to Visual Studio and there's a solution file containing some projects and the IDE enables me to work with them.
In eclipse I have my workspace and can add my projects. My projects may have some dependencies to each other and so on. Works great. But how to manage more than one projects ( or in the VS term solution)?
Do I have to use different workspaces? Ok, I can do that, but what if there's one project I want to use in two or more projects.
It's a beginner question, but an important one I think. So it should be interesting for other .NET users as well. Thanks a lot for helping.
Björn
In eclipse you can add as many as projects you need based on your project dependencies.So now wen we are talking about the dependencies whether do you want add the .jar file or project.Both the ways will help you to get rid of compile errors in your project.
1.Add muiltiple projects just by importing your project
File -> Import -> Select type of your project (Suggested options or i
use : Existing projects into workspace ,Existing maven projects)
2.You can link different projects by
Right click the project in eclipse -> BuildPath ->Configure Build Path
-> Projects -> Add --> (locate your projects in the workspace).
3.You can package your existing project as .war or .jar and add them into your project by
Right click the project in eclipse -> BuildPath ->Configure Build Path
-> Select libraries --> Add external jars (Then locate your jar's and add them).
Basically 2nd option is used in the debugging purpose,while the 3rd is bit tough to debug.
All these projects can be navigated using Project explorer window.

Setting up common classes for access from other projects

I'm trying to set up two Java projects to have access to classes in another Java project.
So far, the situation is visible in the following image:
(source: shrani.si)
However, I can't seem to import any classes from the Common project.
(source: shrani.si)
I could just have multiple packages in a single project, but as far as I know only 1 jar can be compiled per project.
Any help is greatly appreciated.
You need to add your "Common" project to libraries of project where you need to use classes from "Common" project.
For example right-click on "Clinet" project then "Properties"
In right menu choose "Libraries" and press button "Add Project..." and double-click on project "Common".
After that you can add import common.Item;
Also try to clean and build all your projects.

Add scala capabilities into an existing EJB eclipse project

I have an existing EJB project set up in Eclipse Helios, and would like to slowly introduce Scala into the project. The Scala IDE has been installed successfully, and I'm able to create standalone scala project. The issue however comes when trying to use my existing project with scala additions. I've went as far as manually editing the .project, .classpath, and related files under .settings of the project's home directory for eclipse.
However I still have the issue where the Java compiler tries to compiles .scala classes, which results in errors and ultimately not being able to build the project.
Has anyone faced a similar scenario or are there any workarounds?
Thanks in advance.
You should be able to right-click the project, go to "Scala" and click on "add scala nature". Then .scala files should be recognized as such. You might also have to add the scala library to your dependencies. Depending on whether this is a "simple" Eclipse project or you're using Maven there might be other steps required.
Right click on project, and choose Configure/Add Scala Nature.

can eclipse plugin project depend on java project

I have an eclipse plugin project which dependes on java project in my eclipse. usually what I did is export the project as jar and use it as-is in the plugin. but this requires manual work. can I have a reference from my plugin projct to a java project that will be both compile-time and run-time dependency ?
I saw a similar question, but not exactly the same.
I think, the closest thing to this is to create a jar file from the referenced project, and import it to the projects repository. But thats quite hard to manage for a currently developed project.
On the other hand, isn't it possible to simply convert the Java project into a plug-in permanently? If the other user does not use OSGi/Eclipse, he/she will see only a manifest/manifest.mf file (and possibly a plugin.xml) next to the java project specific stuff, so this would not disturb them, but would help you.

Categories

Resources