Error in same project in another machine - java

im just trying to run a test project, but i cant understand why it return this errors, its the same computer configuration
Firewall OFF
Eclipse Kepler SR1 32bits (the same in the other computer)
JRE7 32bits
JDK7 32bits
Maven 3.2.1
JBoss from Eclipse Market
i just imported the zip but look the errors:
http://i.stack.imgur.com/lphI3.png
where it ask for the vraptor-jpa, the version in this pom is the same that is working in this project in other machine, why it has a lot of errors for the SAME THING?
solved some problems by removing the reference to a old .jar and deleting the .m2 folder, not i ended with this:
http://i.stack.imgur.com/gRFll.png

looks like your .classpath has some invalid reference to jar (which doesn't exist), open your <PROJECT_ROOT>/.classpath file and correct invalid references or you can do it with eclipse interface, right click > properties > java build path > fix those invalid entries

Related

Imported project into Eclipse and shows errors right away

I'm using Eclipse Oxygen.1 release 4.7.1 and I'm running jdk and jre version 9 64-bit on a MacOS Sierra system. I imported a project downloaded from the internet and it's showing 2 errors:
1) The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
2) The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
Has anyone ever experienced this? It must be a bug with Eclipse because all I did was import the project and it should work fine. I tried several ways to debug like clean the project and remove the JRE system library then add it again and refresh. Also tried restarting Eclipse several times and restarting my computer. Even reinstalled the JDK and re-downloaded and imported the project a few times. Any feedback would be appreciated. Thank you.
This is a rarely occurring bug in eclipse. Here are the steps to solve it, straight from this answer:
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.

Unable to find package java.lang in classpath or bootclasspath with ant [duplicate]

I'm getting this error
Error:java: Fatal Error: Unable to find package java.lang in classpath or bootclasspath
in IntelliJ when I try to build/compile any project. Something that should be stated here is that NetBeans, Eclipse and even the javac command line can compile, build, and execute the same project without errors. This is why I suspect that the problem lies with IntelliJ, all other IDEs work well.
In IntelliJ I already:
Restarted, reinstalled
Invalidate Caches / restarted
Deleted / readded the JDK in Project JDK
Deleted / readded the JDK in Platform Settings
Rebuild / recompile
In Windows I already:
Deleted / Reinstalled Java SDK
Deleted / Readded the JAVA_HOME, PATH and CLASSPATH on System Variables
Tried the above on User Variables
Deleted and reinstalled IntelliJ IDEA
I already seached for issues like this on the Internet, here on Stack Overflow I found:
Question #1 | Question #2 | Question #3 | Question #4 | Question #5
And 30+ sites, and tried every answer...
Here you can see my IntelliJ Project Structure the last time that I tried to build/compile
I was using Java 1.8 when I got this error, after some hours, I installed Java 1.7 and the project worked fine. Maybe IntelliJ doesn't support Java 1.8?
Anyway, it would be great if anyone knew a way to make Java 1.8 work with IntelliJ.
I just spent quite few hours on this and found a solution which might work for you as well. IntelliJ seems to have a bug which expects the JDK to be in a different directory than is specified. I followed these steps:
open intelliJ, click help -> show log in explorer
modify build-log/build-log.xml and change <priority value="info" /> to <priority value="debug" />, you may have to run the editor as an administrator
run the compilation which fails with "Error:java: Fatal Error: Unable to find..."
open build-log/build.log and search for rt.jar, you should find it in a block with a set of other JRE libraries and the directory which points to the file should be wrong
In my case the JDK is included in D:\Development\software\jdk1.8.0_20, while the log points to C:\Users\Vladimir\Development\software\jdk1.8.0_20
I fixed the issue by copying my JRE to the place which is expected in the log. And just like in your case this seems to only happen with JDK 1.8.
The problem comes from IntelliJ bug (existing at least in version 14).
It happens when your JDK directory is under the user profile directory. For example, JDK located in this directory (for Windows):
C:\Users\myuser\jdk1.8.0_20
will be stored in IntelliJ internal configuration (file 'jdk.table.xml') as:
$USER_HOME$\jdk1.8.0_20
But your %USER_PROFILE% environment variable could point at some other (non default) location. Then IntelliJ will look at the wrong directory.
Possible fix:
Install your JDK at different directory, which is outside your profile directory. Like:
C:\Programs\jdk1.8.0_20
Then register this JDK for use in your IntelliJ project settings.
I encountered this on Arch Linux 4.16.13 with IntelliJ 2018.1.4 after importing a Java project using Gradle. I made sure that there is a registered JDK in "Project Settings" -> "Project" but IntelliJ was unable to find the classes from the JDK, java.util.List for example.
The solution was to add a new JDK entry at the same path as the existing JDK (/usr/lib/jvm/java-8-openjdk in my case). This will cause IntelliJ to put the files under jre onto the classpath whereas with the old JDK entry, only the files under lib were on the classpath.
Had the same problem. Simple fix to others in case the other answers are complex.
Go to File -> Project Structure
Under Project SDK, choose new and add another JDK.
The default use in my case was 1.8 that was of build 181. I choose the 1.8.0_192 I had recently downloaded.
After applying, the project loads itself.
When I re-ran the test, it works!
If this problem occurs when importing a project in netbeans then try to create a new project then check the properties of your new created project and match those properties with the project that you imported in my case there was a difference between target of android package version.
From what I understood, debugging for hours, the problem is with the location where the jdk1.8 gets installed(/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home), instead of under System/Library).
So the following has to be done to fix in intellij
1. For an existing project, right click and select module settings, and SDK and add 1.8 as a version.
2. Using a terminal go to ~/Library/Preferences//options/. Remove the old JDK specific lines in jdk.table.xml. Update the default version in project.default.xml
Clean you project in intellij and build. It should use the new jdk and sync.

Eclipse failing to open

My Eclipse IDE keeps failing to open. I've updated my java to the latest version, I've got the newest Eclipse Version. I'm running x64 Windows, it seems like the Error log is trying to use x32, but I've installed a x64 version of Eclipse. I tried re-installing the x64 version and it still didn't work.
In the Pastebin I've linked is the contents of the Log.
http://pastebin.com/An5CRq3e
EDIT: I'm using x64-bit version of Java
The same happened to me: without renaming my workspace I just deleted the corrupted org.eclipse.core.resources folder in the workspace ($ECLIPSE_WORKSPACE/.metadata/.plugins/) and then Eclipse started successfully again.
Yes, I had to re-import all my projects (as Existing Projects) into the workspace.
Refs: Eclipse forum
Thank you for copying/pasting the log - definitely helpful!
This line looks significant:
Caused by: org.eclipse.core.internal.resources.ResourceException: Incompatible file format. Workspace was saved with an incompatible
SUGGESTIONS:
From a command prompt:
cd into your Eclipse directory
type eclipse -clean -clearPersistedState
Rename (or delete) any old workspaces to force Eclipse to create a new workspace
Yes I have also removed org.eclipse.core.resources folder from my Eclipse workspace :
workspace\.metadata\.plugins\org.eclipse.core.resources
And also run the command in command prompt:
>eclipse.exe -clean -clearPersistedState
After doing this Eclipse should work without any problem.
OR
Open a new workspace.
Here is what worked for me :
Rename your workspace
Open eclipse / talend or any software based on eclipse that give you the error
-- it will recreate a new workspace automacilly
Copy your projects' folders from your old workspace to new workspace
in eclipse(or your software based on eclipse) just reimport your projects from folder
done

An error has occured. Please see log file - eclipse juno

Whenever I start up Eclipse Juno, it gives me an error saying:
An error had occured. Please see the log file:
C:\Program Files\eclipse\configuration\1362989254411.log.
Some websites say to uninstall jdk and install it back again. I did that, but it didn't work. I think it was because on their website, the error is happening IN the workspace. Mine is on the program files folder, which is in the computer.
It happened after updating it. Should I downgrade. If so, how? If I can't downgrade, what should I do?
Try deleting following file from workspace.
YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.core.resources/.snap
Or try launching it from console.
C:\path\to\eclipse\eclipse -clean
Solved :
Quit eclipse
GO to your workspace and delete .metadata folder
Now open eclipse with same Workspace path ( You will see as a new workspace )
Now right click import > General > Existing Projects into Workspace > next > Select root directory -> browse to your current workspace and press OK.
Now you will all see your all projects and then hit OK again.
Voila, same projects with same workspace no migration or reference problem.
After trying everything else, this solves my issue.
Delete the .metadata folder from workspace and start the eclipse and now again import all project in same workspace, this worked for me.
In my mac machine, I checked whether I installed two java versions or not. I got this error. Because i installed two java at a time.
User -> Library -> Java -> JavaVirtualMachines -> version 1.8.0 and version 11.0.1 has been installed.
I removed version 11.0.1. Now its working fine.
I deleted the entire .metadata folder, and it worked for me.
The best way is to delete all the *.snap files from /.metadata/.plugins/
Here's what I did to solve this:
I removed workspace/.metadata
run eclipse as an administrator.
In my case my JAVA_HOME was pointed to jdk9 after pointing JAVA_HOME to jdk8 resolved my issue.
Hope it helps someone.
i found the solution. i have installed 2 versions of jre sdk 1.3 and jre7 so i uninstall the older version sdk1.3 then it works.
C:\path\to\eclipse\eclipse -clean
Then change the working project directory to something different. It should work after that.
This instruction works 100% for me:
Rename the Eclipse workspace name
Start Eclipse (it will start successfully with empty workspace)
Exit it and change workspace name to previous state(if ask to replace some files, press no)
Start Eclipse again and Re import projects in current workspace
Enjoy!
Sounds simple but just delete/uninstall eclipse and install it again.
I was getting the same error while opening the eclipse. to solve that I checked the log file inside the metadata folder. where I found that there is version mismatch of Java. so I have changed the VM inside my eclipse ini file.
-vm
/opt/jdk1.8.0_191/jre/bin
Hope this will also help to solve your problem.
For me it was down to a locking/permissions bug on
(path to Eclipse IDE)\configuration\org.eclipse.osgi.manager.fileTableLock
See here
Spring Tool Suite 4 (64 bit for Windows Server 2016)
Version: 4.2.2.RELEASE
Build Id: 201905232009
based on Eclipse
Version: 2.2.500.v20190307-0500
Build id: I20190307-0500
wouldn't launch and a pop up dialog appeared saying:
launch error has occurred see log file null
(This became apparent from the latest text log file in the folder
(path to Eclipse IDE)\configuration)
!ENTRY org.eclipse.osgi 4 0
2019-06-19 18:41:10.408
!MESSAGE Error reading configuration: C:\opt\sts-4.2.2.RELEASE\configuration\org.eclipse.osgi\.manager\.fileTableLock (Access is denied)
!STACK 0
java.io.FileNotFoundException: C:\opt\sts-4.2.2.RELEASE\configuration\org.eclipse.osgi\.manager\.fileTableLock (Access is denied)
...
I had to go and tweak the permissions via File Explorer (Full access).
It appeared as if the IDE was doing nothing for a while.
The splash screen for Spring Tool Suite (based on Eclipse) eventually disappeared and the IDE started up again.
Now everything is back working correctly again.
None of the current answers worked for me. On CentOS, I had to delete the .eclipse folder from home directory. Then eclipse launched just fine!
I got the same error when I was using Texas Instrument's Code Composer Studio which is built on eclipse. It happened when I changed my Workspace folder to be inside the Google Drive folder. Deleting files from YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.core.resources/ did not work for me.
The following worked for me:
Take backup of original Workspace folder
Delete the original Workspace (from the Google Drive folder)
Start Eclipse (works fine now)
Restore the Workspace backup to a non Google Drive folder
However deleting and restoring the Workspace folder is not advisable since it can have other complications. But I was desperate.
I had 2 version of JDK installed - JDK 7 and JDK 8. Initially it worked even when both the versions were there and was able to use Git and Gradle and up the Spring Boot Application.
Then after system restart/sleep, workspace prompt did not come up.
Uninstalled JDK 7 and it prompts for workspace,now.
I have got the same error after removing eclipse and installing it again.
Deleting the .metadata directory and running eclipse -clean does not work for me, but the following works for me:
sudo cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86_64/
if you have a 32 bits based system do:
sudo cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86/
In my case I didn't want to remove eclipse because in corporate world we can't control everything. Also deleting some files from workspace .matadata could not help. So below hack that I found with trial and error worked for me perfectly :
Go to this path: C:\....\eclipse-Luna\configuration\org.eclipse.core.runtime\
now delete .manager completely.
Start eclipse again and woilaa.. it will run normally.
[In my case, I use eclipse luna. I once abruptly closed the PC when eclipse was open. Then eclipse was not able to start on the next system restart. So keep in mind to close eclipse properly. :) ]
My OS architecture is 64-bit so downloaded Eclipse Oxygen 64-bit version and got this error. Tried various solutions posted here but didn't help. Then downloaded Eclipse Oxygen 32-bit version and it works well.
For me the problem was that I installed Java sdk 1.9 before installing eclipse. deleting it and installing Java sdk 1.8 instead fixed it.
Also, if you are using mac, try
export JAVA_HOME=$(/usr/libexec/java_home)
and then
echo $JAVA_HOME
your should get something like
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
For STS on MacOS, i followed the following steps:
Go to the STS directory from terminal:
cd /Users/karan.verma/Documents/sts-bundle/STS.app/Contents/MacOS
Start STS
./STS
STS started, but all my imported projects were removed.
The reason may be that you are trying to use old version of Eclipse for new version of Java. I've downloaded the latest Eclipse (which is Oxygen) and it worked for me.
It worked for me when I went to WorkSpace\.metadata\.plugins\org.eclipse.e4.workbench and then remove the *.xmi files.
Deleting metadata folder might not work in this case. Or eclipse -clean command. Or reinstall eclipse might not solve this.
Instead try deleting other java versions you might have in your machine.
Check what you have right now using this:
/usr/libexec/java_home -V
Delete other java versions which you don't want, following below command:
sudo rm -rf /System/Library/Java/JavaVirtualMachines/java-version.jdk
This should resolve your issue.
The issue is due to the availability of more than one eclipse versions. I tried removing both installations and started with a clean install and it worked. Also, make sure after the install point to a new workspace.
In my case, error was due to Java 14 , which is not an LTS, downgraded it to java 8 and it worked.
It happened to me after I rename the file folder. I Try to delete my workspace or .metadata or .manager folder, and not work.
Then I download the program again and I choose the complete download. It is 337.511 KB and in zip File. But I place it in Flashdisk. I open the zipfile then I run eclipse.exe. It work. Then I import all my work file. It work back again show in Project Explorer.
I close eclipse. Then I click eclipse icon in desktop ( I didn't delete the program). Now It work fine.
If nothing works, then try uninstalling and then reinstalling Eclipse.
This is how i just fixed this problem after trying everything suggested on this forum.

java.lang.Object cannot be resolved in Eclipse

When I installed the latest installment in Mac OSX - the Mountain Lion - I experienced some problems getting Eclipse to work I also lost most of my Android developer files (but I still have my projects). I suspect this is due to the choice of removing the /Developer and move the XCode and other Apple developer tools (I placed my Android tools here).
I have now installed the latest version of Eclipse and the problem still seems to be around. There are errors in all my projects and I get an error message prompting:
The type java.lang.Object cannot be resolved. It is indirectly referenced
from required .class files
I tried to check the Java class-path both in Eclipse and in my terminal and these seems to be OK. java and javac both run in my terminal and there is a valid path to the java source files in Eclipse (Under Preferences, Java, Installed JREs). That being said I'm not an expert in Eclipse so there may be that I have misunderstood how this problem ought to be solved. Anyone here with similar problems or who know the cure?
Make sure that you have a valid JRE or JDK defined in the Java Build Path of your project. Right-click on your project, select Properties... and then Java Build Path.
I had this problem moving a Maven project from Eclipse to RAD. I had a JSP file that worked in Tomcat and JBoss, but threw a NullPointerException in WebSphere on the form definition during the compile.
Anyway, after transforming the Maven project into an Ant project (mvn ant:ant), I imported the Ant project into RAD and got this error. The fix:
Open the Java Build Path, selecting the Libraries tab.
Find the JRE System Library and remove it.
Add the JRE System Library.
Goofy, but it works. It must reset some property in a file. I don't know if the problem is the older version of Eclipse or RAD.
After updating my Android SDK to make Appcelerator Titanium happy, I started getting "java.lang.Object cannot be resolved" for my Android projects in (non-Titanium) Eclipse.
I updated all dependencies in Eclipse, and the error healed after a restart of Eclipse.
I had that error almost every time I launched Eclipse for the first time; if I close and then re-open Eclipse, the error is gone.
I found this solution useful, though (I've copied here to protect the link, credit goes to the original author):
In Eclipse go to Windows -> Preferences -> Java -> Installed JREs.
Select the currently active JRE/JDK and press the Edit button.
Select the rt.jar and change its position in the list of JRE system libraries (e.g. press the Up button once).
Confirm all changes, clean and rebuild the workspace.
The next time you face the problem reposition the rt.jar again (or reset the order by pressing the Restore Default button).
please select your installed system jre version from java build path.
Try the following and problem will go away
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.
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
I got this error and what I had to do was remove the JRE from the Window/Preferences/Java/Installed JREs and re-add it. This somehow cleared up eclipse's cache and rebuilt the project successfully. To get rid of the error in the file-editor I also had to close it and open the file once again.
My problem was that I had in Eclipse: Window / Preferences... and then in the tree on the left Java / Installed JREs: C:\Program Files\Java\jre7
I changed to: c:\Program Files (x86)\Java\jre7
It solved my problem.
I had the same issue and none of the above solutions worked for me.
Then I realized than the library (libs) folder was missing in the project. Once i added the libs folder and the corresponding Jar file, the issue was resolved..
If your project specific (or if not applicable, workspace default) JDK/JRE is being referenced correctly and you've just begun to get this issue out of the blue: restart Eclipse.
Unfortunately, "restart Eclipse" is one of the standard troubleshooting steps when a project won't build. Eclipse even has a dedicated entry under the File menu.
I had to add the JDK under the build path. After adding the correct build path it worked.
I just had to restart eclipse, and the error went away. Strange.
I solved this by pointing my eclipse to the jre available in jdk.
This error caused by invalid sdk is pointing in your project.properties file of your project.
project.properties -> target=android-19 . change to version which is installed in your eclipse.The error will be gone.
I had the same issue after moving from JRE7 to JDK7. Finally I had to remove the JRE7 configuration from the Eclipse preferences and then add the following two lines to the eclipse.ini file.
-vm
C:\Program Files\Java\jdk1.7.0_55\bin\javaw.exe
I had this problem, and I understood that Eclipse has automatically imported a core reference, instead of the reference for the project I needed.
Deleted the import, and rearranged it, and everything worked fine.
Same problem facing Me
Project->properties->Android
And select the api level and also go in java build path and check some external jar file path if we already add in it.update the jar file path
On "The type java.lang.Object cannot be resolved. It is indirectly referenced
from required .class files":
I found my project had 2 meta-inf.java files in 2 different directories with the same 'module ' on line one (a copy/paste error).
Once this was corrected, I cleared the meta-inf.java file with the issue, rebuilding it line by line, guided by Eclipse, until I had a working module configuration.

Categories