I just restarted my Eclipse and now when I try to run my project via run configuration it is showing this error:
Referenced classpath provider does not exist: org.eclipse.m2e.launchconfig.classpathProvider
Any ideas what the problem is?
Thanks,
It’s probably because your Run Configuration was created on an old project, and has bad entries in the Classpath section. The solution is to delete the Run Configuration and create a new one.
I read here
Related
I am using Intellij for my project development(Java). Strangely, whenever I try to run the project making some new changes to it, Intellij is always running old class files which were complied for a older version of my project. I tried recompiling, rebuilding, tried invalidate caches and restart, removed the project and opened it again but nothing seems to work. Not able to figure out the reason and now I am clueless what to do.
Any help would be appreciated. Thank you.
I've had the same issue and I haven't been able to consistently make it go away, however, here's some things I've tried that could help:
delete .class files
invalidate caches and restart
check settings: sdk and source path imports of IDEA code might affect it
delete and reinstall intellij
Or do what I've ultimately done, which is to create a new project and avoid spending 5 hours tinkering with IntelliJ to get it to run my code properly.
Follow these steps to let IntelliJ "forget" all old internal files:
Close the running IntelliJ instance.
Delete the .idea directory of your project.
Open the project like a new project.
After that you have a fresh IntelliJ project that probably needs some configuration (as usual).
I had such a problem in IntelliJ by a maven enabled project.
Running maven clean phase and ... , but no effect,
any change to classes had no effect in deployed project.
finally I found the problem.
classes was hidden in this path:
{Project Path}\src\main\webapp\WEB-INF\classes{my packages}
by removing this, problems has gone.
Hope it was useful.
In my case it was the maven issue within Intellij settings. When I used bundled version it gave the error it should have. I don't know why giving actual path won't work but Bundled Version will work.
In the context of Java Parser, I needed to run mvn clean install -DskipTests after each change on the command line. Then, class changes were available in IntelliJ. No other way helped here.
What are the possible causes of a "java.lang.Error: Unresolved compilation problem"?
Additional information:
I have seen this after copying a set of updated JAR files from a build on top of the existing JARs and restarting the application. The JARs are built using a Maven build process.
I would expect to see LinkageErrors or ClassNotFound errors if interfaces changed. The above error hints at some lower level problem.
A clean rebuild and redeployment fixed the problem. Could this error indicate a corrupted JAR?
(rewritten 2015-07-28)
Summary: Eclipse had compiled some or all of the classes, and its compiler is more tolerant of errors.
Long explanation:
The default behavior of Eclipse when compiling code with errors in it, is to generate byte code throwing the exception you see, allowing the program to be run. This is possible as Eclipse uses its own built-in compiler, instead of javac from the JDK which Apache Maven uses, and which fails the compilation completely for errors. If you use Eclipse on a Maven project which you are also working with using the command line mvn command, this may happen.
The cure is to fix the errors and recompile, before running again.
The setting is marked with a red box in this screendump:
try to clean the eclipse project
you just try to clean maven by command
mvn clean
and after that following command
mvn eclipse:clean eclipse:eclipse
and rebuild your project....
Your compiled classes may need to be recompiled from the source with the new jars.
Try running "mvn clean" and then rebuild
The major part is correctly answered by Thorbjørn Ravn Andersen.
This answer tries to shed light on the remaining question: how could the class file with errors end up in the jar?
Each build (Maven & javac or Eclipse) signals in its specific way when it hits a compile error, and will refuse to create a Jar file from it (or at least prominently alert you). The most likely cause for silently getting class files with errors into a jar is by concurrent operation of Maven and Eclipse.
If you have Eclipse open while running a mvn build, you should disable Project > Build Automatically until mvn completes.
EDIT:
Let's try to split the riddle into three parts:
(1) What is the meaning of "java.lang.Error: Unresolved compilation
problem"
This has been explained by Thorbjørn Ravn Andersen. There is no doubt that Eclipse found an error at compile time.
(2) How can an eclipse-compiled class file end up in jar file created
by maven (assuming maven is not configured to used ecj for
compilation)?
This could happen either by invoking Maven with no or incomplete cleaning. Or, an automatic Eclipse build could react to changes in the filesystem (done by Maven) and re-compile a class, before Maven proceeds to collect class files into the jar (this is what I meant by "concurrent operation" in my original answer).
(3) How come there is a compile error, but mvn clean succeeds?
Again several possibilities: (a) compilers don't agree whether or not the source code is legal, or (b) Eclipse compiles with broken settings like incomplete classpath, wrong Java compliance etc. Either way a sequence of refresh and clean build in Eclipse should surface the problem.
I had this error when I used a launch configuration that had an invalid classpath. In my case, I had a project that initially used Maven and thus a launch configuration had a Maven classpath element in it. I had later changed the project to use Gradle and removed the Maven classpath from the project's classpath, but the launch configuration still used it. I got this error trying to run it. Cleaning and rebuilding the project did not resolve this error. Instead, edit the launch configuration, remove the project classpath element, then add the project back to the User Entries in the classpath.
I got this error multiple times and struggled to work out. Finally, I removed the run configuration and re-added the default entries. It worked beautifully.
Just try to include package name in eclipse in case if you forgot it
Import all packages before using it, EX: import java.util.Scanner before using Scanner class.
These improvements might work and it will not give Java: Unresolved compilation problem anymore.
Also make sure to check compiler compliance level and selected jdk version is same
As a weird case, I encountered such an exception where the exception message (unresolved compilation bla bla) was hardcoded inside of generated class' itself. Decompiling the class revealed this.
I had the same issue using the visual studio Code. The root cause was backup java file was left in the same directory.
Removed the backup java file
When the build failed, selected the Fix it, it cleaned up the cache and restarted the workSpace.
I'm trying to create a Vaadin application to deploy on a tomcat server following the beginner's guide in the book of Vaadin.
https://vaadin.com/book/-/page/getting-started.maven.html
I used the Maven command line provided at this address. I can successfully create a Maven project, build it with mvn package and import it in eclipse.
Once done, I can add it to my tomcat server and run it. When trying to connect to localhost http://localhost:8080/viznet/ (viznet being the project name) I get a this error :
Requested resource [/VAADIN/widgetsets/viznet.MyAppWidgetset/viznet.MyAppWidgetset.nocache.js] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
I would like to know a) why is this happening b) How can I solve it.
I did a lot of researches yet, found some alike problems but couldn't fix mine. It seems to me I can't get my project to use the default widget (or fix this particular one but the default widget would suit me just fine).
There might be some error in my configuration or missing information here, I'm brand new to this so I don't know what you need to know in order to help me.
Environment:
Ubuntu 14.04
Eclipse 4.1
Maven Latest
Tomcat 8.0
Thanks in advance
I fixed this problem by creating new Maven configuration and adding "package jetty:run" in command line, then just run your project, it should work fine, after this you can use Tomcat again!
You need to compile your widgetset using mvn vaadin:compile. Look at this question.
I am having trouble setting up the build path of my java project. I am currently in a Co-Op IT position so I am somewhat new to all this. My background is mostly in C++ and I am learning java on the fly. I am also somewhat new to Eclipse (Kepler service release 1).
I am working on a bug on an existing program and need to get the program to build so I can work on it. When I add all of the external .jar files that I know for a fact are the right ones, I am getting this error on two of them :
"Archive for required library: '(location of file)' cannot be read or is not a valid ZIP file"
Two of the other full time guys on my team have gotten the program to run with those exact same .jar files, one running Eclipse Indigo and the other running the same Kepler version as myself. I also was able to open the two .jar files manually and everything appears to be there. After every trial trying to fix this, I have refreshed, cleaned and restarted eclipse. The two other full time guys said they have never seen this error. I would like to get some insight on this from anyone who has any similar experiences so that I don't have to use up much more of their time.
I Had this issue, just fixed by deleting .jar files from Libs directory then copy->paste original Jars again. Then do a complete clean -> rebuild
I got this problem, took help from following link solution
which basically says to
1. delete the corresponding maven download folder
2. maven>update project in eclipse
In my case I deleted hibernate folder, since i was getting error related to hibernate-validator.jar
I had the same error here. What I did to resolve the problem was close and reopen the project.
I got the same problem and found out the root cause is the JDK in my linux shell is set to 1.6, but in the eclipse, the JRE is 1.7.
Using Eclipse without m2e features (Standard Edition) helped me.
Similar problem with Spring toolsuite
Just came across this link that shows a way to get unblocked.
In preferences dialog box go to
Java->Compiler->Building
and change Incomplete build path to "Warning" (from default "Error")
This can be done globally (for all projects), or on a project by project basis.
Check the jar's file permissions/ownership.
I had the same issue on eclipse installed on Linux and fixed it by setting the file permissions right.
In my case ..worked after removing this from spirngrest-servlet.xml file.
<prop key="net.sf.ehcache.configurationResourceName">/Sysehcache.xml</prop>
I think it had to do with default location of maven repository of jar files.
Been at it for 3 days. finally solved it.Hope it helps anyone.Just look for similar think in your spirngrest-servlet.xml file. Good luck.
I just tried the following and it worked:
Close eclipse as there might be some files eclipse is accessing and you won't be able to delete.
Delete all the libraries installed in the maven repositories folder: ".m2/repository"
Open eclipse and update your project(Alt+F5).
What did we just do? : This is possible that the existing libraries in the local repository are erroneous and maven tries to open which it fails in. We have now deleted the already existing library and with the project update, Maven will download the library again which should resolve the issue.
i fixed this by just deleting everything inside of the /Users/username/.m2/repository folder. not the repository folder itself. and then running a mvn clean package in the project folder
I am struggling hard to compile a GWT project. I confirmed that GWT, AppEngine and necessary library are referenced to the project (added in the Java Build Path, also GWT is installed successfully from Marketplace).
Using the setting above, I tried to build using GWT and I have been getting
java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler
over and over again.
Then tried to set gwt-dev.jar in Windows CLASSPATH, and I could get off from this error but ended up with
[ERROR] Unable to find 'some/package/My_Project.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
I tried to set project classpath to some/package/ but didn't work.
Even I could manage to get over with this error for once, again I got into another error:
java.lang.NoClassDefFoundError: com/google/appengine/tools/enhancer/Enhance.
I screwed up the environment and couldn't get to the last error I was getting, and I was just stuck on the second error.
I have tried removing all Run Configuration, creating new workspace and import projects from scratch and tried everything that I found on Google.
Did you look at this answer: GWT/ Eclipse: ClassNotFoundException com/google/gwt/dev/Compiler
Also, you can try to clean your project and add the jar file via the usual class path configuration within eclipse (right click on your project). You can then add the gwt-dev.jar file from the plugin. Make sure you use the one that was installed in the plugin for eclipse.
[ERROR] Unable to find 'some/package/My_Project.gwt.xml' on your
classpath; could be a typo, or maybe you forgot to include a classpath
entry for source?
Check out the link for more info...Here