I am using Intellij IDEA as an IDE for running Java programs. Dues to power fluctuation computer got restarted. Now when I launch the IDE after reboot i am getting the error Cannot convert project: /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml: Error on line -1: Premature end of file.
Has anyone encountered this situation before? What can I do to view my project back again?
I also had this after a power failure, I simply deleted the workspace.xml file from the projects .idea folder, restarted IntelliJ and it seemed to be OK apart from loosing which files were open.
Cheers,
Nick
I had this exact error when my laptop bluescreened. I solved it by:
Exit IntelliJ IDEA
Rename .idea folder
Start IntelliJ IDEA
Create new project from existing sources
Exit IntelliJ IDEA
Copy all files from old .idea folder to newly created one.
Restart IntelliJ IDEA
Finally solved the problem. Hers is the solution. First of all I had two Intellij IDEA projects open in two separate windows.
One was the project which had corresponding subversion repository. This was a file-based format project. Files that define a project are .iws, .ipr and .iml. .iws is the one corresponding to the workspace configuration. I just reverted back this file with svn revert project.iws and I could launch my project again.
But the problem in second project JavaDemoCodes still persisted as it was custom project I created and it looks by default we get a directory-based format project instead of file-based format project. This has all its configurations in /home/aniket/.IdeaIC12 directory. As many of you suggested i searched for workspace.xml here but could not find it. I tried find . -name *.xml but i still could not find it(Also as the error suggests there is no file /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml ).Finally I did import project from my first project(the one with svn repo) it detected my JavaDemoCodes project as Intellij IDEA project and let me open it in new window.
Not sure if this is the perfect answer but it solved my problem and yes as someone suggested I deleted .iws file from my 1st svn repo based project and tried to restart but was of no help. New .iws file was created but it still gave me the same error.
I have experienced this same problem. It happens to me when I have IntelliJ open and for whatever reason (usually problems with having multiple VPN connections open), my computer freezes and I have to do a forced re-boot.
My solution is to use Windows 7 restore. I'll go to the folder it is complaining about, right click on it, and do a restore. If I'm lucky, I have a restore point only a few days old.
For me, rebuilding my configuration on several projects from scratch is too time consuming. Using a restore point from a few days or even a week makes more sense.
Good luck.
I solved it just by creating a new project, then starting it and then reopening the old project..
Related
I'm relatively new to programming. I recently installed Spring Tool Suite (the only option I found for the Mac install was for a 64bit version) for Mac on my system, and after installing I created a test project using a java main class to sys out "hello world" to the console. Everything was going swell until I tried to compile and run the program. The console spat back out at me "Error: Cannot find the main class TestApp" (Test App was the name of my main class). I checked it for errors, found none. I thought originally that the project was bad, so I deleted it and created a new project with a similar name. This project returned the same error.
I did some research and found that occasionally the .metadata file for a workspace can be corrupted, so I tried deleting that file, and reopening an STS workspace from the folder to regenerate it. This didn't work, so I tried creating a new file and starting a workspace there, then importing my test project into the new workspace. This also returned the same error.
So then I thought maybe my build path had been corrupted, so I checked and it was pointing to the correct files. I verified that the compiler is working and compiling the run, as the generated bin folder had a binary file in the project had a file in it. I tried I tried deleting the run config and starting over. Still no luck.
I tried project=> Clean, then re-running, then tried deleting the .bin file and re-running, which compiled and created a new binary file, but still returned the same error in the console.
I tried an uninstall and reinstall of STS, deleted all of the folders for my workspaces, and created new folders.
I tried fiddling around in the project libraries to see if any dependencies were missing, and found nothing.
I tried starting a SpringBoot app to see if maybe running Maven for dependencies would help somehow?
Someone suggested it may be an issue with my machine being older, and sure it's old, but it's fully updated, has an i5 processor, 16 gigs ram, and a full TB of storage. I would be really surprised if that were the issue.
These were all of the solutions that I could find, and I may have tried a few other things that I can't remember (I've been at it for the whole day now).
Does anyone have an idea what may be going on here? I'm at that point where punching the computer seems like a possibility. If it is my machine, I know that using the Eclipse IDE with an STS plugin may be more lightweight, but I've heard that the plugin is also kind of a pain to work with. Currently I've just uninstalled STS again, and may try installing again if I can find a new solution to try.
After some further research I came across a way to reconfigure JRE's. I'm not 100% sure of what I did to fix it, but after a full reinstall and new repo folder, I went to configure JRE's when creating a project and set both options to v1.8 . It's working now!
I'm brand new to Eclipse for Android Developers (Eclipse Neon in Ubuntu), and upon creating my first project, I was flooded with errors. It appears that the source of the errors was that the R.java file was never generated.
I've attempted to clean the project and restore from local history (nothing was ever deleted so this accomplished nothing). I've been unable to find a solution to my R.java file never existing in the first place, and help would be very much appreciated.
The Main Reason behind R.java File not generated is :-
First of all i think that is the Problem of your XML file.if you Leave any Mistakes/Errors on your XML file.
Then Eclipse/Android Studio will never generate an R.java.
That is the Solution of your Problem.
Hope this help to generate your File..(:
Try to create project Again (Delete it and create New)
Either your Eclipse is not installed properly.
Any file is missing in Eclipse (While installing it, Antivirus removes some important files, So install Re-install Eclipse keeping your antivirus paused.
I've been trying to open Eclipse to start my work today, and it freezes everytime during load.
My Eclipse is Helios. Someone told me I should remove a file called .lock from .metadata folder, but still didn't work.
Does anyone have any idea of how do I "melt" this thing up?
ps: I opened it yesterday with no problems.
Have you already tried to start Eclipse with a -clean parameter? Sometimes this can resolve some issues..
I would suggest a (big) problem with a plugin in Eclipse.. because project plugins or runtimes will execute later.
Create a new workspace and repimport your projects from your old workspace. If you have a vcs, you can re-checkout them.
Start it with the -clean option.
It should take a bit longer (depends on your eclipse configuration and workspace, but if nothing is really broken, it will get it to work).
I believe something is wrong with your workspace. I typically remove current and create new one in such case. It usually takes up to 5 minutes (if I have to add 20 projects). In most cases it takes less.
I have experienced something similar when launching Eclipse after having to force close it for some reason.
If it always hangs when loading the SVN plugin — like in your screenshot — it is likely to be related to that. In this case I suggest the following:
back up your current workspace
launch Eclipse with the -data command line argument to specify a different workspace folder
if Eclipse starts up successfully, try to import your projects from the original workspace or even better from SVN
This question already has answers here:
Developing for Android in Eclipse: R.java not regenerating
(64 answers)
Closed 9 years ago.
Did a fresh install of Eclipse, JDK and android-sdk.
I am currently receiving this error when creating a new project
[2010-09-26 16:07:56 - Test] ERROR: Unable to open class file C:\workspace\Test\gen\com\example\test\R.java: No such file or directory
What's the reason for this and how do I fix it?
Eclipse Helios 32 bit
java version "1.6.0_21"
Android sdk API 8
P.S. I'm new to Android development.
EDIT: I tried most of your solutions, but nothing worked. So I started using my friend's install of Eclipse Ganymede.
I have had same issue, all what I needed to do, was create project and restart eclipse.
//Edit: Complete collapsing of "Package" tree works as well.
This is a mighty annoying error.
It happens 100% of the time when I create a new android project.
What seems to work for me is to just delete the file (which DOES exist and is accessible by my user), then hit build, and it will regenerate it and stop moaning.
It's clearly a bug as there are too many people getting it simply by filling in the boxes in the new project dialog (like me) without even modifying any code!
Have a look at your console. It is an aapt aborted error. Since aapt is the tool that auto-generates R.java, therefore, R.java was not getting generated.
Since R.java is a auto-generated file that stores information about your drawables you should rebuild your project. Before that have a look at your layout xml files and check them for errors.
Notice that Project -> Build All should be selected. Also try to run your project.
Removing Read Only attribute on Eclipse workspace directory and Project->Clean->Build Project
did the trick for me. I then clicked on the project directory from within Eclipse and did a F5 (Refresh) . R.java was generated in the gen folder.
I had a similar error on the creation of new projects myself. After messing around I tried moving the R.Java file into the same location as my projects java file (the src file). Eclipse then saw I removed the R.Java file from its location and created another and that seemed to clean up the error.....I dont know if it was because eclipse rebuilt the file and then saw it or what but that seemed to work for now.
After creating the Project, Right click the Project Folder within the Project Explorer on the Left Tab of Eclipse.
Click on Source->Format.
The Console will say:
[2010-11-24 11:57:42 - YourProject] R.java was modified manually! Reverting to generated version!
Then you're good to go. Try running your Project and it will compile.
Check your imports. If this has sneaked in, then delete it.
import android.R;
Had a almost identical issue with Eclipse Helios 64 bit on Linux, but I had the "1.6.0" API selected like you. The bizarre thing was I could type;
cat <the path it was moaning about>
in a console it would display correctly.
I created a new AVD which used Android 2.1, the issue magically vanished. Perhaps it's a bug in Android SDK or Eclipse?
Right click on your project name in package explorer. Then click 'Validate'. It will be fine.
Here is how to fix it:
Go to your "workspace" folder and make sure it's not "read-only"
Eclipse Menu > Projects > clean
Had the same issue.I was able to solve it by doing the following:
go to Window/Preferences/Java/Build Path
select 'Folders' and change the output folder to 'gen' (this is where Android looks for the generated java files,but the default in eclipse is 'bin').
restart Eclipse
Windows 7,Eclipse 3.5.2
Configure buildpath.. check android , it worked, of course i followed one of the posts mentioned above window, preferences, java, java build path and selected project,
then created a project, and tried to build same error, then i checked build path and saw android is unchecked, checked it and build again, it works!
I had this exact same problem with no helpful errors. finally, I tried deleting my debug keystore and it worked:
rm ~/.android/debug.keystore
I had seen people mention that, but I figured it wasn't my problem because I wasn't getting any errors relating to the debug keystore. I found the answer here:
"Debug certificate expired" error in Eclipse Android plugins
apparently the debug keystore is only valid for one year.
I would say that once you have created your project and you've mention the R.class error --> just restart the Eclipse IDE and everything will be fine ;)
1.-Open Eclipse
2.-Open Window/Preference
3.-Expand JAVA option
4.-Select Build Path
5.-Check the option "Projec"t and uncheck "folder" options
6.-Click on OK
7.-Restart eclipse IDE
Let's go to code !!
This problem can be solved by merely cleaning and rebuilding the project. How ever there is a link to the latest version of Eclipse for Android.
**Eclipse Java EE IDE for Web Developers.
Build id: 20100218-1602
(c) Copyright Eclipse contributors and others 2005, 2009. All rights reserved.
Visit http://www.eclipse.org/webtools**
Here is a link to Android Tutorial with Eclipse
http://developer.android.com/resources/tutorials/hello-world.html
In mac,
I select Project>Clean
after that, i unchecked Build Automatically
then i run the project and it works :)
Windows 7 64bit, run eclipse as administrator, solved the problem for me.
In my case there was no gen folder after pressing clear...
To solve it, i created a new gen file, then when to Build Path => Configure Path, and pressed ok.
All went smooth after that :-)
Following steps are done as solutions:
1. Collapse the project tree structure
2. Go to the workspace and remove the readonly permission of the workspace.
3. right click "default.properties" and go to properties and uncheck the readonly permission in eclipse.( this is done when the workspace shows build error even though there are no compilation issues)
Today I see a strange behaviour of Eclipse 3.5.2 for the first time in 3 months.
First, when I run a main function, it runs a previously compiled version. Let's say I press Ctrl+F11 in the window with an open java class and existing main function. Usually it rebuilds the class and runs a new version. Today even if there was a compile mistake, it would run fine. So I guess it does not recompile the class.
Next, more strangely, if I intentionally make a mistake in the code and Eclipse underlines those lines in red, still the project Explorer does not mark them as containing errors. They remain of grey color if there were not any errors.
First I did not know how to solve this problem. I tried to reopen the project, restart Eclipse and finally reboot the OS. After the tenth attempt, after rebooting, Eclipse said that all project's files are "OUT OF SYNC with the file system". When I pressed "Refresh" - F5 on a project's header name in Project Explorer it finally marked all the files with errors as containing errors and running the main function gave the desired result.
An hour of my work passed and this happened again , with the other project. All the same. No marking of files as red, running no matter what old version of class with no compile errors.
And since Eclipse does not tell that files are out of sync, simply pressing F5 on a project cannot help.
What can you suggest?
When you select a project in the Project Explorer view and press F5, Eclipse should traverse the entire directory tree for the project checking that all files and directories all in sync. It does for me ...
The only thing I can think of that would cause this not to work is if you have file system timestamp anomalies. For example, if a file in the file system is updated but the file's last-modified shows that it was updated in the past. This kind of thing can happen if your machine's system clock is moved backwards or forwards at an inconvenient time. If you think this might have happened, try closing all projects, restarting Eclipse and doing another F5 refresh.
(I used to run into Eclipse synchronization issues a lot, but I put that down to a combination of flakey plugins and doing builds from the command line. Either F5 or Project>Clean usually works for me.)
It is also worth checking that you haven't turned off "Build automatically"; see https://stackoverflow.com/a/2818290/139985. This is not a "refresh" problem, but it would be easy to confuse it with one.
Is Build automatically on? (Menu > Project > Build automatically)
It happened to me because there was a cyclic dependency between two projects. Each project had the other on its build path.
Solution: Reimport the project
It happened to me when checking out a new file from svn in explorer. Eclipse could not find the new file for some reason.
I tried refreshing the project(F5) and Project > Clean and build the project(Project > Build All) none of these worked for me.
So I deleted the project from the Project Explorer view(Not from hard disk). Make sure you unselect "Delete project contents on disk(cannot be undone)" checkbox and save any unsaved changes before you do this.
Now reimport the project using File > Import option. That should work in most cases.
If you use gradle, or something similar, instead of reimporting a project you can just regenerate the project files (gradle eclipse for example), and then you can refresh the project. Less cumbersome than deleting and reimporting.