NoClassDefFoundError in eclipse plugin execution - java

I'm building eclipse plugin that uses JDT/AST.
Building the plugin works fine, but when I tried to run the plugin. I go this error message.
It complains that the ASTVisitor class is not found.
I checked the org.eclipse.jdt.core***.jar is in the build path with User Libraries.
What might be wrong? Do I need to setup execution path that points to jar files?

Eclipse plugins manage dependencies using the Manifest.MF file. Check in the dependencies tab of your Manifest.MF file that you have org.eclipse.jdt.core as a required plugin.

Related

Creating a jar from maven project Intellij

I created a new maven project in IntelliJ and set packaging to jar and when I build it, there is a jar file target folder. But when I run the file I get the error as
no main manifest attribute, in QeToolHelper-0.1-SNAPSHOT.jar
I have created jar file using maven-assembly-plugin. I have added these lines in pom.xml for that.
Tried few methods described in other similar questions but to no avail.
Have you looked at SpringBoot and associated plugins. It can be used to build a standalone java applications.
With regards to your specific issue, that error is symtomatic of a failure to declare main class in your manifest. The main-class attribute in the manifest tells the jvm what class to load from the built jar. Looks like the settings in your maven config are failing to generate the resources correctly.
I was able to solve this issue by creating jar package from maven.
Running the build package created the jar in target directory.

Eclipse failing to see Gradle provided jar

We have a Gradle project that I'm trying to use in Eclipse.
After other users made changes and I had to do a Gradle Refresh, Eclipse now can't compile the project.
The project was not built since its build path is incomplete. Cannot find the class file for
org.springframework.retry.support.RetryTemplate. Fix the build path then try building this project
The type org.springframework.retry.support.RetryTemplate cannot be resolved. It is indirectly
referenced from required .class files RabbitMQConfig.java /Account/src/main/java/com/efi/metrix/config line 1 Java Problem
If I use Ctrl-T, I can see the class and what jar it is in. The jar IS in the classpath and can be seen under the "Project and External Dependencies" section in Package Explorer.
I've tried deleting the jar and re-running Gradle Refresh, which downloads the jar again, and I get the same error with the build failing. I've also tried an Eclipse Clean on the project.
(I did try restarting eclipse as well.)
Any hints on what might be causing this?
Finally tracked this down.
Eclipse project, Properties -> Java Compiler -> Errors/Warnings
In the "Enable annotation-based null analysis" section, if you have "Inherit null annotations" enabled, you get the compile errors.
I turned off that option, and it now compiles without errors.

Using JPA, JavaFX and Maven, error of NoClassDefFoundError: javax/persistence/Persistence Intellij

I did a Maven project and I use the JavaFX style in Intellij IDEA, I had all the jar necessary to run my project and when I execute in IDE everything works perfectly but when I build the jar file and run appear this error:
You just package your code and not dependencies into your jar. So the dependencies are not in the classpath when you just run your jar file.
There are different ways of how to package the application. For example create an exe or add the necessary jars to the classpath.

How to develop OSGi bundles without opening or importing the dependent bundles in Eclipse?

I am currently facing a problem where eclipse is not able to resolve a plugin dependency specified in the manifest.
Let me generalize my problem with the help of 2 plugins.
Say one plugin is a core plugin “com.mycompany.core”, and the other is a fancy plugin “com.mycompany.fancy”.
The plugin com.mycompany.core is a plugin owned by a different team and is deployed in my company’s maven repository, under the group id “com.example”
My team owns com.mycompany.fancy. This plugin has a dependency to the plugin “com.mycompany.core”.
For simplicity sake let me call these plugins “fancy” and “core” respectively.
We would like to work with only the “fancy” plugin in the eclipse IDE.
I am currently building the “fancy" plugin using tycho. The pom file of the fancy plugin has an explicit dependency to “core” plugin in its dependencies section.
I generate the .classpath and the .project for the “fancy” plugin using
Mvn eclipse:eclipse
After importing the generated project for the fancy plugin in eclipse IDE, I see that eclipse is not able to resolve the dependency to the “core” plugin that is specified in its Manifest file. Eclipse reports an error saying “Bundle ‘com.mycompany.core’ cannot be resolved.
Under the referenced libraries of the “fancy” project, I see that eclipse lists the “core” plugin. The location of the core plugin jar is C:\mvn_repo\com\example\com.mycompany.core\1.0.0\com.mycompany.core-1.0.0.jar
This is the location where the “Core” plugin jar is deployed in maven, and this location is a valid location on my machine.
I also see that the generated .classpath file for “fancy” has the following entry
However, eclipse is not able to resolve the dependency entry for the plugin “Core” in the manifest of “Fancy”.
From command line, there are no issues seen. However, the fact that there are errors in eclipse, means that we cannot launch/run anything from within eclipse, which is a show stopper for us.
Does anyone know how to get around this problem, or what it would take for eclipse to recognize the bundle that has been specified with its location in the .classpath file?
You need to define a Target Platform that can be used by both the Tycho build and in your IDE workspaces. Eclipse's default behavior for bundle/plug-in development is to use the running IDE as the Target Platform, but that's an unfortunate default because it's a very bad idea for almost any "real" project. Instead you should use a specific TP in which you dictate exactly what dependencies you have, and use that same target definition in Tycho, too.
Look at the maven scope setting when you declare the bundle depency. Offhand I think you're looking forRUNTIME.

How to build eclipse plugin via commandline

I need to integrate a existing Eclipse plugin project into our build factory. I compiled the plugin with javac and created a jar file, but it is not working as plugin for Eclipse. I receive a lot of exception "unable to load class".
Google return mostly Maven but I can not change the existing build process.
Does anybody has an idea what is required to do this?
put your created jar in eclipse\plugins folder and restart eclips.

Categories