Why does eclipse break when the .project file is hidden? - eclipse

Why does eclipse break with the error "Could not write file: M:\workspaces\eclipse\project.project. M:\workspaces\eclipse\project.project (Access is denied)" when the .project file is hidden (on the Windows file system)? Note: This happens w/ other files as well.
Steps to Reproduce:
1. Install the latest eclipse, I am using eclipse-jee-galileo-SR2-win32.zip. (Not sure if it happens in other versions)
2. Create a project.
3. Browse to the project in windows explorer, find the .project file.
4. Right click -> properties
5. Under Attributes check hidden.
6. In eclipse, open the .project file, make a change and try to save.
7. After you get the error, uncheck the hidden box and save again.

Network drive can sometimes have the issue of marking files with the hidden attribute (see this thread for instance)
As illustrated by this IBM technote, this issue might be related to Sun bug 6350200:
When opening a hidden file for write access the FileNotFoundException exception is thrown. If you remove the hidden attribute (via attrib) the exception is not thrown and application works correctly.
Resolution: fixed with JDK6_b3 (what JDK are you using to run your eclipse?), but might still have some problem the IBM technote reports as fully fixed only in JDK7! So right now, you have to remove the hidden attribute for Eclipse to be able to successfully opened it and write in it.

Related

How to recover a .java class in an Eclipse project?

I opened the Eclipse as usual from an installer (I downloaded the complete jBPM engine and Eclipse is included with it). I open it from a command prompt. When I opened the Eclipse I found it is empty as it is installed recently. no projects or tabs or anything.
I reopened the project I am working on and found that the main file that containing the code is empty (it is one line with hidden words). I opened the project from its location on the hard disk and I found the file is also empty but I can see that there is something on it.
I tried to open the project on Netbeans but the problem is still exist. I tried to open the file from the local history but I found nothing in the history. Unfortunately I didn't take a backup from my last work. I don't know what to do right now, if you can help it will be appreciated. I attached here a picture for the eclipse with the empty file:
If the project is already deployed in some server then you can decompile them from deployed folder(i.e : webapps folder of Tomcat)

Eclipse opening and then closing immediately

Eclipse keeps showing the splash screen and then closing immediately after...I just downloaded it so I haven't had the opportunity to make a work space. I've tried uninstalling and reinstalling, the file has already been unzipped at this point I have no idea as to what I should do about this.
Make sure that you have installed Java JDK properly
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Whenever it (Eclipse) encounters a problem that does not warrant launching a dialog, Eclipse saves a report in the workspace log file. The log file can be looked at in four alternative ways.
Locate the file yourself, see workspace/.metadata/.log.
Start Eclipse using -consoleLog. This will print the messages
that normally go to the .log file in the enclosing shell/command window. When the Java VM suffers a hard crash, it produces a separate logging file named something like hs_err_pidXXXXX.log. These files are also helpful for diagnosing
problems.
(Other two might not be useful in your case)
Window > Show View > PDE Runtime > Error Log. This gives you a view
with the contents of the .log file.
Help > About Eclipse Platform > Configuration Details. This
prints out a great number of details about the environment and
also concatenates the .log file. Great for including in a bug
report.
Source
Make sure that Java installed properly..
Uninstall Java and install again, this worked for me

Failed to create the part's controls in Eclipse with Salesforce

I have Eclipse Juno and Force.com IDE. When I try to create new classes they always show: failed to create the part's controls. It worked for the first time, but now they always show this. Same happens if I create them inside the force.com platform.
Error details:
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
etc ...
I would appreciate all help.
I had the same error. I fixed it by switching the eclipse workspace. Go to menu File->Switch Workspace->Other, and then select the same workspace you were working with. Eclipse will restart and you should not get the error.
I faced the same issue my default editor for JSP was Web page editor. Which I changed to JSP editor and everything is fine.
PS: To change to JSP editor
Right click on JSP page -->open with jsp .
I got the "failed to create the part's controls" error one day when I opened Eclipse and tried to view a java file I had been working on. When I opened the file I needed, it showed a red X and NullPointerException instead of the code. The error log mentioned "event loop exception" for some reason.
I restarted Eclipse, and the error was still there. I cleaned the project, updated the project, deleted and re-imported the project, deleted and re-imported the file, and the error still was there. As a last resort, I restarted Eclipse again and then the file was fine. So one of the clean/update/delete/import steps worked but I don't know which one.
Use eclipse -clean from command prompt to solve this problem.
I solved my problem like this:
This problem occur because of in eclipse default editor is not able to identify extension of that file. If you right click on file and open it with respective text editor ,problem will be solved
In ecllipse, every file types has some associated default formats and one of the default format set to the particular file type.
You can see this in General -> Editors -> File Associations-
This issue generally occurs when we open any file in the format which is not the default format of the particular types.
I got same issue when I opened one of the Java file in text format in ecllipse and then I started getting the same issue. After research, I observed that AspectJ/Java Editor was setting as default. After reset it to Java Editor, the problem got resolved.
Steps :
1. General -> Editors -> File Associations-
2. Select the content type and choose the default format for it.
3. Restart the ecllipse.
In general, it is some default file format that set in ecllipse causing the same issue.
in my case problem was that the server was resin and I didn't have the resin server extension installed
I solved the problem.
(1)Open the filed with TXT.
(2)Search and Delete the underline between number like:
int a = 10_000;
It works when i compile and run as others used, but it will fail if i save and open again.
I also had for the same problem and fixed it by updating eclipse. Help > Check for Updates.
This worked for me---->
Right click on pom.xml-->open with-->xml editor
Had a similar stacktrace on failed to create the part's controls while trying to open Git repositories view in Git perspective.
My case (cause) is different since I was migrating an Eclipse workspace from an Ubuntu VM to Windows.
Many thing were copied like projects, .git folders, or also .metadata Eclipse folder.
Tried with no success:
uninstall all egit component (installation details, then, install new software
restart eclipse -clean
reset Git repository perspective
I searched and found this invalid UNIX : separator in .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.egit.core.prefs file.
GitRepositoriesView.GitDirectories=/path1/.git\:/path2/.git
Here, the : is invalid path separator on Windows.
I simply removed the value in this line, saved file, and restarted Eclipse:
GitRepositoriesView.GitDirectories=
(alternative: if needed, try to migrate those linux paths to their Windows equivalent too)
Git repositories view is back.

Eclipse - An internal error occurred during: "Compute launch button tooltip"

I launched Eclipse earlier to jot down a snippet and was faced with the following as an error when I tried to run a fresh project:
An internal error occurred during: "Compute launch button tooltip".
That popup window shows as soon as I mouse-over the run icon in the top bar, or if I right click on the class in the explorer window and select any of the run/debug options.
After doing some research on the error, I see several people who posted similar messages but they all have been fresh installs of Eclipse. So note that this is not a fresh install, and that Eclipse was working fine earlier today. Also note that not only does my new project not run (with the normal main method), but projects I was running earlier have all stopped working with the same error.
Finally, also be aware that after seeing other people's suggestions on fixing this, one specifically said to select run configurations from the top of the page run menu. When I selected run configurations from this dropdown, I got the following message:
Exception occurred creating launch configuration tabs
Reason: Plug-in org.eclipse.jdt.debug.ui was unable to load class org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup
After that message, the run window opens but all of the tabs are missing. Like where you can set the display width and height, and the other tabs, they are all missing from the window now.
I was using Eclipse trouble free earlier today and I am sure no updates took place between when Eclipse was working and now. My question is of multiple parts: What is wrong in a nutshell? What could have caused this?
Got this from another site of some guy who got this same error after upgrading.
Worked for me as well.
Apparently putting the following line in your eclipse.ini helps:
-Dcom.ibm.icu.util.TimeZone.DefaultTimeZoneType=ICU
Try setting the launch properties in:
Window>Preferences>Run/Debug(Expand)>Launching(Click)
Under launch Operations menu set it to:
Always launch the previously launched application
Click:
Apply>Ok
I never found out what went wrong, but a reinstall of eclipse fixed it. All projects survived seemingly undamaged.
Thanks for the reply on the .ini but that did no good.
I had same error today - in an eclipse installation (Juno SR2 64bit) that has been running fine for months.
0: There were no changes on svn for my projects since yesterday (when it was running fine).
1: I restored the workspace from a 'Windows 7 -> Properties -> previous copy' backup. This failed because the directory structure of the '.metadata' contains folders with a deeper structure than is supported.
2: I restored the workspace from a overnight archive (gzipped so file depth is not an issue).
This had no effect.
3: I tried to restore the eclipse installation directory (which seems to be updated an awful lot) from a 'Windows 7 -> Properties -> previous copy' backup. Again this failed - because of folder-depth issues (Note: it is installed in the root directory of my disk - so there is actually no way to use a restore on this installation!)
4: Had to delete the .metadata from my workspace and reinstall eclipse (and all the additional plugins), and re-import my projects, and setup all the servers, and android, etc, which took many hours.
The moral of the story? Backup both your workspace AND the eclipse installation every night manually. Windows Restore will NOT save you. Backing up your workspace is NOT enough.
I had the same problem using eclipse mars. I cleared the folder .recommenders\index
And that solved my issue.
Hope it helps.
incase you are having the eclipse files which you have downloaded from the official site .Just extract those file in the same folder where your previous eclipse was installed and select replace all.
best solution
I also encountered this issue, the reason why this issue occurred on my project was due to I was missing the JRE System Library in the root folder of my project.
To solve this issue, make sure you have the libraries like JRE System Libraries on the root folder of your project.

Can't save project preferences in Eclipse

All I am trying to do is to set the Java compiler for my project as 5.0. It is 1.4 by default. When I try to save by pressing OK button I get the following error.
Preferences Save Failed:
Reason:
Exception Occured while saving project preferences:
/com.myproj.reqmanager.ui/.settings/org.eclipse.jdt.ui.prefs.
I never got this error earlier. I mean I have imported this project before and saved preference settings without any problem. Out of nowhere I am getting this problem now.
Like Liam I store my project on Dropbox and use it on two different machines and also got the same error. A simple refresh (select the project and press F5, or rightclick on the project and choose Refresh) did the trick for me, as the resource was out of sync. This is usually displayed (e.g. in the editor when trying to edit a source file), but in the case of preferences you'll have to find that message in eclipse's log:
!MESSAGE Exception occurred while saving project preferences: /Utils/.settings/org.eclipse.jdt.core.prefs.
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Resource is out of sync with the file system: '/Utils/.settings/org.eclipse.jdt.core.prefs'.
This might actually be the issue for both of you, as any external modification to a project will cause this out of sync error, and creating a new workspace or using another eclipse version likely purges eclipse's cache, resulting in an automatic refresh.
If you follow this thread, this can be:
because of the use of Eclipse with a workspace on a network drive (not necessarily your case, but worth mentioning just in case)
because the file is somehow locked (either by another process or by a Version Control System with pessimistic locking). See also bug 130266:
Read-only project files come up a lot when dealing with source control systems (like Perforce) that make the local files read-only until they are "checked out".
Five years later and this still occurs. In my case I moved the .settings folder, saved again (.settings is created automatically) and merged the files manually.
Happens on Android Developer Tools Build: v22.6.2.
Check the project's Properties -> Java Compiler, and make sure the 'Compiler compliance level' is 1.8 or 1.7 instead of 1.4.
If this still fails to remove the error, deleting the .settings folder certainly works.
I had this problem also. I had used two versions of eclipse, one on my home machine (juno) and one on my work machine (indigo). Both shared the same folder using a Dropbox folder. All worked fine until I wanted to make some editor style changes, the settings would not save.
The solution in my case was to update the indigo version to juno on my work machine.
Delete the eclipse project files:
.settings (directory)
.project
.classpath
File -> Import... -> Maven -> Existing Maven Projects