I'm using Netbeans IDE (Version 13) for Java development.
In the projects view Netbeans shows a tab for "Project Files". This usually contains files like pom.xml, settings.xml and nb-configuration.xml for an opened Java project.
Now I have added some custom files in the same folder directory as the aforementioned files, namely a Jenkinsfile.config as well as a lombok.config file.
I would like Netbeans to show these files under the "Project Files" tab for each project but until now I wasn't able to find a solution for this.
I already added the file type ".config" as a file association for Netbeans and associated it to the MIME type "Properties Files".
Now Netbeans recognizes the files (an even their contents) when in the "Files" view but they are still not shown anywhere in the "Projects" view.
Does anyone have any suggestions?
[EDIT]: Ideally I would prefer a solution that doesn't require installing any plugins from sources outside of Apache (or similar).
Maybe it is even possible to just configure Netbeans to show the desired behaviour.
You can download and install plugin readmeinprojectview, see here how.
Then go to Tools -> Options -> Miscellaneous -> Display more files. Add the files you need to show in the Project tab. In your case they are Jenkinsfile and lombok.
The plugin by default adds the following files to the project tab under the root project node. Without the plugin, NetBeans for Maven-based projects displays ONLY logical folders under the root project node i.e. "Source Packages" or "Project Files"...
Currently you cannot put the files you want under the "Project files" node. Here is the source code of NetBeans for Maven-based project types. As you can see under the "Project files" node goes the following files only:
pom.xml
nbactions.xml
Files that start with nbactions- and end with .xml
nb-configuration.xml
Maven's default settings.xml
Related
I have a project which I am converting from plain Java to Maven.
I used the "Configure -> Convert to Maven Project" option in eclipse.
I removed all jars in the classpath and referenced them in my POM file and built the project
My new classes are built in project/target but when I launch from eclipse, (using the original launcher) , the old classes are in project\bin folder are used.
How do I reconfigure this to use the correct classes ?
Seems that the configuration for output files in eclipse has not change.
Try to change the output of generated files in eclipse manually:
Right click in project -> Properties.
Select "Java build path" and tab "Sources".
At bottom you have a field named "Default output folder". Change it for: <your-project>/target/classes
For example:
Hope it works.
I imported a git folder https://github.com/TeamLapen/Vampirism.git ((If you were wondering)). And so now I have it within my eclipse workspace, but not "really". Here's what I mean: The project shows up in the tree on the left of the eclipse window, but the folder itsself is NOT located in the /workspace/ like the other projects.
All I did in the code was change a few lines to fix a bug, as is highlighted below.
Anyways, when I go to export the file (File > Export > Jar), a few things happen:
In the box on the left, you see the project name is "Vampirismx". In the middle box, you see that the project is NOT AVAILABLE FOR EXPORT. In the right box, you see the only files "available" for export are the classpath and project files.
Can someone help me?
Tl;dr
I imported an eclipse project from git. When trying to export it, the project isn't showing up.
looking at the git repository, it does not provide eclipse project settings, and indicates only step by step instructions for intelliJ.
So when you imported it into eclipse, you have it on your workspace like a plain project, not a java one and that is why trying to export it as JAR does not shows up.
You must indicates that the project is a java project and it should work.
also, i'm not familiar with gradle, but seams there is a goal for settings things in eclipse : https://github.com/TeamLapen/Vampirism#setting-up-vampirism-in-another-environment
How do I import a jar in Eclipse?
You can add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar. A quick demo here.
The above solution is obviously a "Quick" one. However, if you are working on a project where you need to commit files to the source control repository, I would recommend adding Jar files to a dedicated library folder within your source control repository and referencing few or all of them as mentioned above.
Adding external Jar is not smart in case you want to change the project location in filesystem.
The best way is to add the jar to build path so your project will compile if exported:
Create a folder called lib in your project folder.
copy to this folder all the jar files you need.
Refresh your project in eclipse.
Select all the jar files, then right click on one of them and select Build Path -> Add to Build Path
Two choices:
1/ From the project:
2/ If you have already other jar imported, from the directory "References Libraries":
Both will lead you to this screen where you can mange your libraries:
Here are the steps:
click File > Import. The Import window opens.
Under Select an import source, click J2EE > App Client JAR file.
Click Next.
In the Application Client file field, enter the location and name of the application client JAR file that you want to import. You can click the Browse button to select the JAR file from the file system.
In the Application Client project field, type a new project name or select an application client project from the drop-down list. If you type a new name in this field, the application client project will be created based on the version of the application client JAR file, and it will use the default location.
In the Target runtime drop-down list, select the application server that you want to target for your development. This selection affects the run time settings by modifying the class path entries for the project.
If you want to add the new module to an enterprise application project, select the Add project to an EAR check box and then select an existing enterprise application project from the list or create a new one by clicking New.
Note: If you type a new enterprise application project name, the enterprise application project will be created in the default location with the lowest compatible J2EE version based on the version of the project being created. If you want to specify a different version or a different location for the enterprise application, you must use the New Enterprise Application Project wizard.
Click Finish to import the application client JAR file.
Just a comment on importing jars into Eclipse (plug-in development) projects:
In case you are developing Eclipse plug-ins, it makes sense to use Eclipse's native bundling mechanism instead of just importing the jar into a plug-in project. Eclipse (or better its underlying OSGi runtime, Equinox) uses so-called bundles which contain some more information than plain jars (e.g., version infos, dependencies to other bundles, exported packages; see the MANIFEST.MF file). Because of this information, OSGi bundles can be dynamically loaded/unloaded and there is automatic dependency resolution available in an OSGi/Eclipse runtime. Hence, using OSGi bundles instead of plain jars (contained inside another OSGi bundle) has some advantages.
(BTW: Eclipse plug-ins are the same thing as OSGi bundles.)
There is a good chance that somebody already bundled a certain (3rd party) library as an OSGi bundle. You might want to take a look at the following bundle repositories:
http://www.springsource.com/repository/app/
http://download.eclipse.org/tools/orbit/downloads/
http://www.osgi.org/Repository/HomePage
Eclipse -> Preferences -> Java -> Build Path -> User Libraries -> New(Name it) -> Add external Jars
(I recommend dragging your new libraries into the eclipse folder before any of these steps to keep everything together, that way if you reinstall Eclipse or your OS you won't have to rwlink anything except the JDK) Now select the jar files you want. Click OK.
Right click on your project and choose Build Path -> Add Library
FYI just code and then right click and Source->Organize Imports
Jar File in the system path is:
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
ojdbc14.jar(it's jar file)
To import jar file in your Eclipse IDE, follow the steps given below.
Right-click on your project
Select Build Path
Click on Configure Build Path
Click on Libraries, select Modulepath and select Add External JARs
Select the jar file from the required folder
Click and Apply and Ok
first of all you will go to your project what you are created
and next right click in your mouse and select properties in the bottom
and select build in path in the left corner and add external jar file add click apply .that's it
In eclipse I included a compressed jar file i.e. zip file. Eclipse allowed me to add this zip file as an external jar but when I tried to access the classes in the jar they weren't showing up.
After a lot of trial and error I found that using a zip format doesn't work. When I added a jar file then it worked for me.
Right Click on the Project.
Click on Build Path.
Click On Configure Build Path.
Under Libraries, Click on Add Jar or Add External Jar.
If you are having a trouble on udemy course of chad on springboot for the importing the jar. Then follow these steps.
Right click on the project.
You will see a option of Build Path, click on it.
You will have a option of Configure Build path, click on it.
Go to libraries.
Then go to the place where you have a jar files make them into a new folder and upload on a new place.
Then click on Add External Jars, you will surely be able to upload it which will help on classpathxmlapplicationcontext as well.
Thank you.
I have been developing in NetBeans, I am exploring changing over to eclipse.
We have a set of directories for the modules in our project; we have scripts that check things out of Subversion and do other things with that directory tree, and we have NetBeans access the sources, etc., from that directory tree.
All our modules are built, etc., with Maven. All of this works fine from within NetBeans.
I have successfully imported all the projects into eclipse (File / Import / Maven), but evidently something is different in the handling of "generated sources". We have some castor-generated files in one module, and jaxb-generated files in another. The generated files in both cases are not found by the compiler, and therefore these modules have compile errors.
Maven is configured to generate the Java classes which cannot be found; maven clean deletes them and maven compiler:compile puts them back. But in eclipse those java files cannot be found for compiling other classes, but in NetBeans they can.
I tried deleting the generated java files, then rebuilding in eclipse; the java files were regenerated in generated-sources, but still cannot be found by the compiler when it comes time to compile (or syntax-highlight) my code.
It sort of looks like a classpath issue, but we don't set the classpath in NetBeans for a maven project. How should I configure things in eclipse so the generated class files are found?
In Eclipse in the Package Explorer right click the project folder which contains the missing files. Goto "Build Path >" then "Configure Build Path...". Properties for your project folder will open.
Click on the "Source" tab. Then click on the "Add Folder..." on the left. A source folder selector box opens, here select your folder which contains the auto generated sources. Normally it will be in the target directory. Then press ok. If this will not work, try one directory deeper or less deep.
If there is no target directory, build the project folder with maven on a shell.
The generated-sources directory will be stored in the .classpath file in your project folder.
HTH.
I installed jRebel on Netbeans 7.4 beta one day, the next day all my source folders an libraries to disappeared from my projects - except Maven ones. Like this:
The source folders are still present on my drive:
I just need to restore their visibility in my opened Netbeans projects.
When I try to add source packages from the "Properties" menu of the project, I do get the source back but as folders, not packages.
Help would be much appreciated!
Try going to Files view in Neteans, and look under the src folder in your project. Does the src folder have a sub-folder named java?
If not, create it (right click on src, go to New, select Folder). Your source packages should re-appear in the project view.
This is for Netbeans 8.0. I am not sure if it is available for other versions.
Right click on the project -> Set Configuration -> Customize -> Sources -> Add Folder for Sources Packages Folder -> Select folders you want to see under your project -> OK
Netbeans version 8:
In files tab, go to main folder and create a folder called java. That's it!