Complete procedures for deploying an Eclipse plugin - java

Currently I have a plugin project at hand. I want to export it as an archived zip file so my colleagues can simply grab the file and install it by themselves.
There are dependencies, icons, and some files in my plugin. Everything works in debug mode, but problems arise once I try to deploy the plugin.
Below are the approaches I have tried with no success.
Approach 1
Right click on my plugin project
Click "Export..."
Select "Deployable plug-ins and fragments"
Check my plugin
Under "Destination" tab, select "Archive file", then set the export path
Under "Options" tab, check "Package plug-ins as individual JAR archives" and "Allow for binary cycles in target platform"
Click "Finish"
The archive file contains a "plugin" folder with one jar file inside. Then, I copy the jar file to "C:\eclipse\dropins" and restart Eclipse. I can see my plugin there but an error will be generated if I run the wizard defined in the plugin, saying that the "Activator" class cannot be found.
Approach 2
Create a Feature Project
Enter a name and click "Next"
Select "Initialize from the plug-ins list" and check my plugin
Click "Finish"
Open "feature.xml" and go to the "Dependencies" tab
Click "Compute"
Save the file
Right click the feature project and click "Export..."
Select "Deployable features" and click "Next"
Check my feature in "Available Features"
Under "Destination" tab, select "Archive file", then set the export path
Under "Options" tab, select "Package as individual JAR archives" and check the two sub-checkboxes, check "Allow for binary cycles in target platform"
Click "Finish"
There are 2 folders and 2 jar files in the zip file. I copy the contents in both the folders "features" and "plugins" to their counterparts in my Eclipse folder. It is better this time, I can see my icon next to my wizard, but there is an error "Unexpected Exception: MyTestPlugin Feature does not exist (org.eclipse.jdt.core)".
I tried using different export options, and use the Eclipse UI (Help --> Install new software...) to install the plugin. They just did not work.
As I am new in this field, I would like to know how to export and import an Eclipse plugin.

Plugins should go under the "plugins" folder, and you may either unslect the "Package as individual jar archieves ... " option, or extract the generated "your_feature.jar" file as a folder, and copy that folder under the "features" folder of eclipse.

Related

Customizing which files are shown in Netbeans' Project View under Project Files

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

Eclipse error "the import com.microsoft cannot be resolved" [duplicate]

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.

Adding jar files into eclipse in a LibGdx project

I tried to add a jar file in the "core" project by doing:
right click in the project->properties->java build path -> libraries -> add external jars
And when I tried to see the class file it says "source not found" also it's giving me this error:
java.lang.NoClassDefFoundError
How can I add my jar files in a libgdx project?
It is saying source not found because you need to attach the source files separately.
To do this, simply expand the jar file(s) in question (double-click on it, or click on the arrow in the library in the Java Build Path section.), and then click on Source attachment, and click edit. Then click browse on the window that will pop up, and find a file that is has a name likened to src.zip, or something similar, in the library's directory.
Essentially, this adds the compressed source package that may be required by that library, so it can access it.

How do I designate a folder as a Source folder by default in IntelliJ IDEA?

I have a somewhat atypical folder structure where my java sources are in 2 different source folder,
src/main/java
src/main/some-generated-code
IntelliJ does not recognize some-generated-code as a source folder and this obviously leads to all sorts of red-warnings in the IDE.
One way to fix this obviously is to go to the Project explorer right click on some-generated-code and "Mark Directory As Sources". This works fine. However I have multiple projects with the same structure and I was wondering if it is possible to by default have any folder with the structure src/main/some-generated-code designated as a "Source" folder.
Do this:
-Right click on the project in Intellij
-Click on "Open Module Settings"
-You'll see something like the below image.
-To assign a folder as a source, click on it and then click Sources
-

Add .jars in alternative folder

I am new to Eclipse and Java, and I know that .jar files I need to add into libs derectory so that compiler could recognize them. How I can add .jars not only in libs folder but also in other folder too. How can I configure Eclipse to do that?
It's easiest if you have the jar files visible in the package explorer to start with, i.e. within your project directory. At that point, you can just right-click on the jar file, go to the "Build path" section of the context menu, then select "Add to build path".
If the jar file is elsewhere and you don't want to move it, you can right-click on the project, and under the "Build path" part of the context menu, select "Add external archives...". Then find the jar file in the file browser, and hit OK.
All of this can also be done from the project properties dialog, in the Java Build Path section.
Right Click project
Select Properties
Select Java Build Path
Under Tab Libraries Click on add jars or add external jar to add the required jars
The Java build path is used while compiling a Java project to discover dependent classes . It is made up of the following items:
Code in the source folders
Jars and classes folder associated with the project
Classes and libraries exported by projects referenced by this
project
Our goal is to feed our classes with the dependent classes present in the jars during compile time. Eclipse provies with number of easy ways to do it .Here you can find a good article about how to add the jars in the projects with screenshorts attached to it http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

Categories