Related
I am having problem running my grails application from grails GGTS IDE.
I had to format my harddisk so i had to reinstall all new software. I had a copy of Groovy/Grails Tool Suite. I didn't need to install it since it was stand alone so i just ran it. Since i didn't have java installed i installed jdk 1.8. so now in the path C:\Program Files (x86)\Java i could see both jdk1.8.0_65 folder and jre1.8.0_65 folder.
Now i imported a git project by doing git clone from ggts. Now the final thing i did was that i went to window > Preferences. There in Java > Installed JREs in the right side i clicked on Add.. chose standard VM and and clicked on Directory ... for JRE home and then located the jdk location. c:\program files(x86)\java\jdk1.8.0_65.
After following these steps i get the following error message.
"The project was not built since its build path is incomplete. Cannot find the class file for groovy.lang.GroovyObject. Fix the build path then try building this project"
am i missing any other configurations? if so, please let me know. I appreciate your help!
Note: One thing i am noting is that when i go to properties of the project and select java build path and select libraries and there is JRE System Library [jdk1.8.0_65]. I expand it and there in Native library location i notice it has (None). Does this have anything to do with the errors i am getting?
Did you try to right-click on project and "Grails Tool -> Refresh Dependencies"?
It's also possible to execute it from command line (confirmed on Ubuntu):
grails compile --non-interactive --refresh-dependencies
I am getting the following error after importing a project in Eclipse:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
However, I have set the path as C:\Program Files\Java\jdk1.6.0_41 in Eclipse Kepler, through Window » Preferences » Java » Installed JREs.
This is an annoying Eclipse Bug which seems to bite now and then. See http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html for a possible solution, otherwise try the following;
Close the project and reopen it.
Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries)
OR
Delete and Re-import the project and if necessary do the above steps again.
The better cure is to try NetBeans instead of Eclipse :-)
The following steps could help:
Right-click on project » Properties » Java Build Path
Select Libraries tab
Find the JRE System Library and remove it
Click Add Library... button at right side » Add the JRE System Library (Workspace default JRE)
This happened to me when I imported a Java 1.8 project from Eclipse Luna into Eclipse Kepler.
Right click on project > Build path > configure build path...
Select the Libraries tab, you should see the Java 1.8 jre with an error
Select the java 1.8 jre and click the Remove button
Add Library... > JRE System Library > Next > workspace default > Finish
Click OK to close the properties window
Go to the project menu > Clean... > OK
Et voilà, that worked for me.
Here is how I solved it:
In Java-ADT: Windows - Preference - Java - Installed JREs
Just add another JRE, pointing to the 'jre' folder under your JDK folder. (jre is included in the jdk). Make sure you chose the new jre.
Object class is the base class for all the classes in java, if you are missing this it means you don't have the jdk libs in your buildpath. I don't know much about Kepler but you need to make sure it points to a correct jdk for compilation and a correct jre for running your java apps.
However I have set the path as C:\Program Files\Java\jdk1.6.0_41 from
eclipse Kepler toolbar->windows->preferences->java->installed jre
You are trying to point jdk instead of jre in your preferences. toolbar->windows->preferences->java->installed jre should point to a jre and not jdk.
Have you installed a different version JRE after , while using previous version of JRE in Eclipse .
if Not than :
Right click on your project -> Build Path -> Configure Build Path
Go to 'Libraries' tab
Add Library -> JRE System Library -> Next -> Workspace default JRE (or you can Choose Alternate JRE form your System) -> Finish
if Yes than .
Right click on your project -> Build Path -> Configure Build Path
Go to 'Libraries' tab
Remove Previous Version
Add Library -> JRE System Library -> Next -> Workspace default JRE (or you can Choose Alternate JRE from your System) -> Finish
No amount of cleaning, closing/reopening the project&IDE, removing/adding the JRE in build path worked for me.
The solution I found was to remove the project from Eclipse (not from disk), remove the project's Eclipse files from the disk, and import into Eclipse again. That worked.
It is even faster if you are using Maven:
Close Eclipse (no need to remove the project)
Run mvn clean eclipse:clean eclipse:eclipse
Open Eclipse. Your project is still present and the problem should be gone.
This seems to be an Eclipse bug, though restarting Eclipse worked great for me, hope this helps somebody else too.
Edit: the next time I had this problem the solution above did not work - the problem was that the imported project I had - had the wrong java runtime set - which was not present (I had java 8 in my JRE present, but the project imported was set to Java 11, so I had to change the project java version to 8. Alternative would be to add more JRE's in the Eclipse preferences - if the project really needs a newer JRE to work)
None of the other answers worked for me. But doing this did:
Right click the project in the package explorer.
Source > Clean up...
Next > Finish
When I did this Eclipse added an import into one of my classes. I think this occurred because I saved my project with a missing import, probably rushing to get home after work.
Right click on project -->Show in Navigator
In navigator view you can see .classpath file, do delete this file and build the project. This worked for me.
PS. If you have integrated you eclipse project with some version control like perfoce/svn , then unlinking the project before you delete the .classpath will be helpful.
Another problem could be that the Android Project Build Target is not set.
Right-click the project
Choose Properties
Click Android
Tick the appropriate Project Build Target
Apply | OK
I was facing this issue with play-java application on eclipse after adding a controller,
I removed and reinstalled JRE through build path and then removed and imported my project which solved this issue automatically.
Thanks gyro.
What solved my problem was to
1) Install the jdk under directory with no spaces:
C:/Java
Instead of
C:/Program Files/Java
This is a known issue in Windows. I fixed JAVA_HOME as well
2) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:
C:/Java/jdk1.7.0_79/jre/bin/javaw.exe
Instead of:
C:/Java/jdk1.7.0_79/bin/javaw.exe
Good luck
I had the similar problem. It was a maven project with the following snippet of pom.xml.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
</plugins>
</build>
I had to change the following.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
If you have already installed JDK 11 and working with java 9 or java 10 as maven compiler, eclipse can not detect. Hence change the release to 11 or the actual installed version of JDK.
I had same problem in eclipse windows that I couldn't added dependant .class files from the JNI.
In order resolve the same, I ported all the code to NetBeans IDE.
Can not add all the classes files from the JNI/JNA folder in Eclipse (JAVA, Windows 7)
While we are working with tomcat 6 and jdk 1.8 versions, some of the features will not work and this error you are getting is one. you need to change the jdk version to stable version(preferable jdk 1.6 or jdk 1.8_65) in eclipse to resolve this error.
in eclipse
step 1: properties -> java build path -> jre system library(remove)
step 2: add -> jre system library -> alternate jre -> installed jre -> add -> Standard VM -> (in jre home, place jdk path) -> finish
now clean and check the project
I got this error because I have installed "Eclipse IDE for Enterprise Java Developers", I uninstalled this and installed "Eclipse IDE for Java Developers". Problem solved for me.
It's working for me after unchecking 'User '--releae option' in eclipse Java-compiler
In eclipse step 1: properties -> java Complier -> uchecking 'User '--releae option' option -> finish
Java version 13.0.1
Eclipse version : Eclipse IDE for Enterprise Java Developers.
However I have set the path as C:\Program Files\Java\jdk1.6.0_41 from eclipse Kepler toolbar->windows->preferences->java->installed jre
If you have already added JRE and still showing error. try follow
right click on your project
project->build path-> configure build path -> java build path -> libraries tab -> select JRE system library and click edit button -> If alternative JRE is selected choose workspace default JRE.
this is how my error gone.
Happend to me after I've installed some updates in eclipse but forgot to restart afterwards. So maybe restarting eclipse might help.
However trivial this might be, check your Java installation. For me, rt.jar was missing.
I found this after fiddling for half a day with Eclipse settings and getting nowhere.
Desperate, I finally decided to try compiling the project from the command line. I wasn't expecting to see anything wrong since I thought it's an Eclipse issue but to my astonishment I saw this:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
I don't know what happened to my Java installation and where did rt.jar go. Anyway this comes as a reminder to go through the fail checklist and tick all the boxes no matter how unbelievable they are. It would have saved me a lot of time.
Right click on project, select Maven -> Update project.
That should solve the issue.
In my case it was a big modular project and the 'red X' was showing only in the parent project.
I went to the parent project
Properties -> Built Path
a removed the JRE Library there, just that, no JRE Library on the parent project anymore.
None of these solutions worked for me. In my case the problem was that I had some Java code producing .java files and I had accidentally created a file called Class.java (content doesn't seem to matter). Removing the file fixed the problem.
sometimes this error happened after updating JAVA. if so go to eclipse.ini file in the same folder where eclipse existed. then change the line under -vm keyward to the new path of jre/bin folder to get the path go to programfiles -> java -> jre latest version -> bin folder copy the path and replace in line under -vm keyword.
This error message occurs when a class/java-project is unable to resolve correct JDK libraries. Say, in my primary Project A, I was getting this error. This Project A had a maven dependency for a project B. Project B pointed to JDK-11. Project A pointed to JDK-9
Correction I did : Made Project also point to JDK-11. It resolved the issue for me
For Gradle users, use eclipse plugin. I'm not using eclipse directly but jdtls on Neovim. This solves the issue for me.
build.gradle
plugins {
id 'java'
id 'eclipse'
}
Then run
gradle cleanEclipse eclipse
I am getting the following error after importing a project in Eclipse:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
However, I have set the path as C:\Program Files\Java\jdk1.6.0_41 in Eclipse Kepler, through Window » Preferences » Java » Installed JREs.
This is an annoying Eclipse Bug which seems to bite now and then. See http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html for a possible solution, otherwise try the following;
Close the project and reopen it.
Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries)
OR
Delete and Re-import the project and if necessary do the above steps again.
The better cure is to try NetBeans instead of Eclipse :-)
The following steps could help:
Right-click on project » Properties » Java Build Path
Select Libraries tab
Find the JRE System Library and remove it
Click Add Library... button at right side » Add the JRE System Library (Workspace default JRE)
This happened to me when I imported a Java 1.8 project from Eclipse Luna into Eclipse Kepler.
Right click on project > Build path > configure build path...
Select the Libraries tab, you should see the Java 1.8 jre with an error
Select the java 1.8 jre and click the Remove button
Add Library... > JRE System Library > Next > workspace default > Finish
Click OK to close the properties window
Go to the project menu > Clean... > OK
Et voilà, that worked for me.
Here is how I solved it:
In Java-ADT: Windows - Preference - Java - Installed JREs
Just add another JRE, pointing to the 'jre' folder under your JDK folder. (jre is included in the jdk). Make sure you chose the new jre.
Object class is the base class for all the classes in java, if you are missing this it means you don't have the jdk libs in your buildpath. I don't know much about Kepler but you need to make sure it points to a correct jdk for compilation and a correct jre for running your java apps.
However I have set the path as C:\Program Files\Java\jdk1.6.0_41 from
eclipse Kepler toolbar->windows->preferences->java->installed jre
You are trying to point jdk instead of jre in your preferences. toolbar->windows->preferences->java->installed jre should point to a jre and not jdk.
Have you installed a different version JRE after , while using previous version of JRE in Eclipse .
if Not than :
Right click on your project -> Build Path -> Configure Build Path
Go to 'Libraries' tab
Add Library -> JRE System Library -> Next -> Workspace default JRE (or you can Choose Alternate JRE form your System) -> Finish
if Yes than .
Right click on your project -> Build Path -> Configure Build Path
Go to 'Libraries' tab
Remove Previous Version
Add Library -> JRE System Library -> Next -> Workspace default JRE (or you can Choose Alternate JRE from your System) -> Finish
No amount of cleaning, closing/reopening the project&IDE, removing/adding the JRE in build path worked for me.
The solution I found was to remove the project from Eclipse (not from disk), remove the project's Eclipse files from the disk, and import into Eclipse again. That worked.
It is even faster if you are using Maven:
Close Eclipse (no need to remove the project)
Run mvn clean eclipse:clean eclipse:eclipse
Open Eclipse. Your project is still present and the problem should be gone.
This seems to be an Eclipse bug, though restarting Eclipse worked great for me, hope this helps somebody else too.
Edit: the next time I had this problem the solution above did not work - the problem was that the imported project I had - had the wrong java runtime set - which was not present (I had java 8 in my JRE present, but the project imported was set to Java 11, so I had to change the project java version to 8. Alternative would be to add more JRE's in the Eclipse preferences - if the project really needs a newer JRE to work)
None of the other answers worked for me. But doing this did:
Right click the project in the package explorer.
Source > Clean up...
Next > Finish
When I did this Eclipse added an import into one of my classes. I think this occurred because I saved my project with a missing import, probably rushing to get home after work.
Right click on project -->Show in Navigator
In navigator view you can see .classpath file, do delete this file and build the project. This worked for me.
PS. If you have integrated you eclipse project with some version control like perfoce/svn , then unlinking the project before you delete the .classpath will be helpful.
Another problem could be that the Android Project Build Target is not set.
Right-click the project
Choose Properties
Click Android
Tick the appropriate Project Build Target
Apply | OK
I was facing this issue with play-java application on eclipse after adding a controller,
I removed and reinstalled JRE through build path and then removed and imported my project which solved this issue automatically.
Thanks gyro.
What solved my problem was to
1) Install the jdk under directory with no spaces:
C:/Java
Instead of
C:/Program Files/Java
This is a known issue in Windows. I fixed JAVA_HOME as well
2) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:
C:/Java/jdk1.7.0_79/jre/bin/javaw.exe
Instead of:
C:/Java/jdk1.7.0_79/bin/javaw.exe
Good luck
I had the similar problem. It was a maven project with the following snippet of pom.xml.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
</plugins>
</build>
I had to change the following.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
If you have already installed JDK 11 and working with java 9 or java 10 as maven compiler, eclipse can not detect. Hence change the release to 11 or the actual installed version of JDK.
I had same problem in eclipse windows that I couldn't added dependant .class files from the JNI.
In order resolve the same, I ported all the code to NetBeans IDE.
Can not add all the classes files from the JNI/JNA folder in Eclipse (JAVA, Windows 7)
While we are working with tomcat 6 and jdk 1.8 versions, some of the features will not work and this error you are getting is one. you need to change the jdk version to stable version(preferable jdk 1.6 or jdk 1.8_65) in eclipse to resolve this error.
in eclipse
step 1: properties -> java build path -> jre system library(remove)
step 2: add -> jre system library -> alternate jre -> installed jre -> add -> Standard VM -> (in jre home, place jdk path) -> finish
now clean and check the project
I got this error because I have installed "Eclipse IDE for Enterprise Java Developers", I uninstalled this and installed "Eclipse IDE for Java Developers". Problem solved for me.
It's working for me after unchecking 'User '--releae option' in eclipse Java-compiler
In eclipse step 1: properties -> java Complier -> uchecking 'User '--releae option' option -> finish
Java version 13.0.1
Eclipse version : Eclipse IDE for Enterprise Java Developers.
However I have set the path as C:\Program Files\Java\jdk1.6.0_41 from eclipse Kepler toolbar->windows->preferences->java->installed jre
If you have already added JRE and still showing error. try follow
right click on your project
project->build path-> configure build path -> java build path -> libraries tab -> select JRE system library and click edit button -> If alternative JRE is selected choose workspace default JRE.
this is how my error gone.
Happend to me after I've installed some updates in eclipse but forgot to restart afterwards. So maybe restarting eclipse might help.
However trivial this might be, check your Java installation. For me, rt.jar was missing.
I found this after fiddling for half a day with Eclipse settings and getting nowhere.
Desperate, I finally decided to try compiling the project from the command line. I wasn't expecting to see anything wrong since I thought it's an Eclipse issue but to my astonishment I saw this:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
I don't know what happened to my Java installation and where did rt.jar go. Anyway this comes as a reminder to go through the fail checklist and tick all the boxes no matter how unbelievable they are. It would have saved me a lot of time.
Right click on project, select Maven -> Update project.
That should solve the issue.
In my case it was a big modular project and the 'red X' was showing only in the parent project.
I went to the parent project
Properties -> Built Path
a removed the JRE Library there, just that, no JRE Library on the parent project anymore.
None of these solutions worked for me. In my case the problem was that I had some Java code producing .java files and I had accidentally created a file called Class.java (content doesn't seem to matter). Removing the file fixed the problem.
sometimes this error happened after updating JAVA. if so go to eclipse.ini file in the same folder where eclipse existed. then change the line under -vm keyward to the new path of jre/bin folder to get the path go to programfiles -> java -> jre latest version -> bin folder copy the path and replace in line under -vm keyword.
This error message occurs when a class/java-project is unable to resolve correct JDK libraries. Say, in my primary Project A, I was getting this error. This Project A had a maven dependency for a project B. Project B pointed to JDK-11. Project A pointed to JDK-9
Correction I did : Made Project also point to JDK-11. It resolved the issue for me
For Gradle users, use eclipse plugin. I'm not using eclipse directly but jdtls on Neovim. This solves the issue for me.
build.gradle
plugins {
id 'java'
id 'eclipse'
}
Then run
gradle cleanEclipse eclipse
I am writing my code in eclipse, the code is running fine but when I try to build it in ant by running build.xml. I am getting
Java Virtual Machine Launcher: Could not find the main class. Program will exit.
Any suggestions?
if you are using java 1.6 and upgraded eclipse, it's more likely caused by eclipse the solution is to go to Run as → External tools configuration… → JRE where the default was set to “Separate JDK”: jdk1.6.0_31 and change this to “run in the same JRE as the workspace” (1.7/1.8), and it should works.
Bug fix would be to provide a working default configuration with setup. Configuration should be in a way it does not break if the user adds additional JDKs to Preferences.
for more details you can see Bug 472599
You need to verify few things
1) Is the path to java bin directory set properly?? (To check this you need to write command javac in command prompt(cmd) and you will get a list of instructions on cmd console) 2) Open the eclipse and go to Window-> Preferences-> Ant-> Runtime in the Classpath tab, see Ant Home Entries pointing to the wrong directory (it still points to the last directory, this directory does not exist) you have to do is to change the Ant Home pointing to the correct directory, to point Ant Home button select Ant Home directory, for example, I use Eclipse 3.3.1, Ant Home is the Eclipse plugin directory org.apache.ant_1. 7.0.v200706080842.
Right click on the build.xml file and select Run As --> External tool configurations --> Jre --> Select Run in the same JRE as the workspace.
If you are using Java 1.5 (that is, it is specified in your workspace, project or ant configuration as the JVM to use), it is also caused by a bug/feature in Eclipse: Java 1.5 is no longer supported. You need to upgrade to Java 1.6.
See: Eclipse bugs 421423
The version of ant you're using may not be compatible with the version of java you are using. I have ant 1.9.4 and was trying to run with java 1.4 and got this same error. Running with java 1.7 fixed it for me!
Error I was facing :
"Could not find the main class :
org.eclipse.ant.internal.launching.remote.internalAntRunner. Program will exit."
To compile my code with JDK 1.8, i have added external ANT to my eclipse, which was working fine. But compiling the code with JDK 1.6 with same ANT version was not working.
Solution : I restored the ANT in to its default value by selecting " Restore Default Entries " ( ANT --> Run as --> External Tools configurations --> classpath" ), after that ANT with JDK 1.6 is working fine.
Above error was happening for me when i added external ANT to my eclipse which was compatible with JDK 1.8 usage. Ant was working with JDK 1.8, the same was not working with 1.6 JDK. Once i restored ANT classpath settings to its default eclipse values which was JDK 1.6 compatable, above error was gone.
I went through and uninstalled all Java from my computer. Then I installed JavaSE JDK1.7. I then modified Eclipse configuration so it would start and opened it up. I have an Ant script to build my project and I want to build my project against 1.7, but whenever I run the script, it says
'Launching PROJECT build.xml' has encountered a problem.
Specified VM install not found: type Standard VM, name jdk1.6.0_21
The installed JRE in Eclipse is 1.7 and nothing else. I cannot for the life of me find how to change what Ant is looking for.
This is because you still have the old JDK configured as JRE in the External Tools Configuration" in eclipse - open it via the arrow menu next to this button in the toolbar: , then change it to the Java 7 JDK.
In Eclipse, click the ant file -- Run As -- External Tools Configuration and click on the JRE tab.
Select "Run in the same JRE as the workspace"
Delete the "C:\Users\%USERNAME%\workspace.metadata.plugins\org.eclipse.debug.core.launches\%PROJECT_NAME% build.xml.launch file"
That solved problem for me.