I had my project in VS Code's installation directory (C:\Program Files\Microsoft VS Code) because I don't like that any files related to a program placed all over the PC. Then I decided to update VSCode. After the update the folder where my project was, has gone. Are there any ways to restore it? Atleast some of the files? I'm using Windows 7 and don't have any Git accounts.
Windows build-in restoration tool gives me 1 week old folder of my project. I did alot since then. Sometimes you shouldn't work too hard.
I think your best bet is to look if there is any backup of your windows 7 computer to recover your file.
Looks like i got the same problem, when VS Code updates it updates also its installation directory C:\Program Files\Microsoft VS Code, which means any file you create in the installation directory gets deleted, so that's why the Project folder got deleted. It is best to keep your project folders and files in your system for example C:\Projects.. Alternatively you can always use version control ie Git to ensure safety of your code
I have a weird one.
I was working on a project in Eclipse (with CDT) when my computer went blue-screen. I remember saving all the files quite recently before that. The computer rebooted with no problems, but when I opened Eclipse again, the file that I was editing at the time was empty (not deleted, so I can't Restore from Local History). All the other files were intact. What happened, is this a problem with Eclipse or my computer, and how can I retrieve the file?
EDIT: I viewed the file using vim on Cygwin and actually it wasn't empty, it was full of unprintable ^# characters.
Right click on the file and choose 'Replace with > Local History...'. This will show you the last few versions of the file that Eclipse has saved.
Checking local history in eclipse didn't actually show anything, but I did solve it another way. What I did is I went to <workspace>/.metadata/.plugins/org.eclipse.core.resources/.history as suggested here, and sorted the entries by last modified. I scrolled down to the latest entry before the crash, then opened the files inside it one by one until I found the file that was erased.
After an unplanned system restart, all of my Notepad++ temp (and unsaved) tabs are gone.
How can I avoid this in future?
I don't want to have to save explicitly every single temp file with a file name.
Is there a plugin for NP++, which saves my session every time I'm editing an active tab or every X minutes?
Or is there an equivalent (and comfortable) editor to NP++, which autostores it's session automatically?
You can find a Notepad++ plugin called AutoSave for autosaving your files here: https://github.com/francostellari/NppPlugins/tree/main/AutoSave
(Used to link to https://sites.google.com/site/fstellari/nppplugins but that's no longer online, cached version is still available here)
It autosaves every minute, but it's configurable, and allows you to choose to save only the current document or all open documents.
From Notepad++ 6.6 or later there are in core and don't need any plugin.
Via menu => Settings => Preferences => Backup => Enable session snapshot and periodic backup
To date, there are two AutoSave plugins available.
To download, click on the Plugins menu and select Plugin Manager (or Plugins Admin). It will pop-up a window with a list of plugins.
Autosave by Franco-stellari —
This autosaves files. Option available to configure timing after autosave, or autosave when npp loses focus.
Autosave2 by www.scout-soft.com - This autosaves files by creating copy of the file. This is useful in case you retain previous saves, such as for incremental development.
Select either of the two AutoSave plugin available and click on Install. If the plugins are not listed, use the links above, and save the .dll to npp's plugins folder according to instructions on the sites.
Update:
in the newest version of Notepad++:
save the plugin's .DLL in Notepad++'s plugins\[plugin name] folder,
go Settings→Import→Import Plugin(s)... and select the .DLL you just saved,
Restart N++. The plugin should appear in the "Plugins" menu.
UPDATE 2022
For those who look for answear on similar question, I`ll try to give detailed description.
I`m personnaly use integrated backup/autosave for Notepad++ which, I think cover any needs for this functionality and better option can be only files versioning tools like git/hg etc.
So...
Go to:
Settings / Preferences / Backup
This will open settings which containe two section:
Session snapshot and periodic backup
Backup on save
First option in first section is Remember current session for next launch:
After enable this, on restart NP++ will be open all session related instances, like opened files, project in projects panel etc, from previous session. But this may did not help if NP++ for some reason was unexpectedly closed(the process freezes, the power supply of the computer is interrupted, etc.) and as result you lost unsaved state of your files.
To partially protect against such an unpleasant accident, you can use the following option: Enable session snapshot and periodic backup:
After enable this, NP++ will after the interval specified in the option Backup in every N seconds, check all open and UNsaved in NP++ files, and save a copy of them with a timestamp in the file name extension(if in Windows explorer display extensions dissabled you can't see timestamp and see only filename wo extension), to the folder specified in the Backup path option.
d:\Temp\ff_stickers.js
d:\SYNCFOLDER\Settings\NP++\backup\ff_stickers.js#2022-04-19_141352
After you save original file, NP++ immediately delete this backup copy.
Also, enabling this option allows you to exit NP++ without saving opened and unsaved files. When you close the NP++, it does not prompt you to save opened and unsaved files, and the next time you open it, it displays them in the same way as before close - marked as unsaved.
Regarding the option Backup path - you cannot change this path,
because it depends on where the NP++ configuration files are stored.
By default, this is the folder backup in same folder where NP++
itself is located. In my case (on my screen), this path is located in
the same place as the configuration files path, specified in the Cloud
option:
Which was added to be able to synchronize NP++ settings.
The next options, already in the second section:
None
Simple backup
Verbose backup
With option Simple backup:
while you save original file in NP++, it will add *.bak file with previous saved state, next to the original:
d:\Temp\ff_stickers.js
d:\Temp\ff_stickers.js.bak
This *.bak remains the only one and is replaced on every save of original file.
With option Verbose backup:
while you save original file in NP++, it will add subfolder nppBackup next to the original file, and save there *.bak file with previous saved state.
d:\Temp\ff_stickers.js
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_141952.bak
These files are not replaced when you save the original, and there are remain as many of them as you save the origanal file.
d:\Temp\ff_stickers.js
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_141952.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142717.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142718.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142719.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142720.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142721.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142722.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142723.bak
d:\Temp\nppBackup\ff_stickers.js.2022-04-19_142732.bak
And last option Directory, allows you to save *.bak files to a directory of your choice(here you can specify an arbitrary path).
d:\Temp\ff_stickers.js
d:\taravasya\BackUps\NPpp\ff_stickers.js.2022-04-19_143305.bak
Hope it help to use this great app and will save someone a lot of time and nerves))
Update November 2020
Autosave as it should be works on Notepad 32 bit V7.9.1
Before Nov. 2020
The autosave without a backup copy (just save after a time interval or by loosing the focus on the file) seems DEAD as of 2020.
AutoSave In Notepad++
You can enable the AutoSave function in Notepad++ using the below Steps:
Open Notepad++
Open Plugins on Top/ Plugins Admin.
Now Search for AutoSave from the options and Select it
Click on Install, Notepad++ will get restarted
i.e, you can find that plugin under the plugin area on the top.
NB: Just go to the Autosave plugin and enable the time what you want in "Options".
That's it ! COMPLETED
When I start, Eclipse says "Workspace Cannot Be Locked"
"Could not launch the product because the associated workspace is currently in use by another Eclipse application." or “Workspace in use or cannot be created, chose a different one.”
But I know it isn't.
How do I "unlock" it?
Just delete the .lock file in the .metadata directory in your eclipse workspace directory.
Precaution - If you delete the .metadata folder all preference will be deleted.
I've seen 3 other fixes so far:
in .metadata/, rm .lock file
if #1 doesn't work, try killing the process javaw.exe etc. then rm .lock file
if #1 and #2 don't work, try rm .log file in .metadata/, and double check .plugin/.
This has always worked for me: relocate .metadata/, open and close eclipse, then overwrite .metadata back
The solution boils down to cleaning up the .metadata folder.
Go to TaskManager(Right Click in the Task Bar) and select Processess menu bar and select eclipse.exe and Click EndProcess
Another possible cause of the “Workspace in use or cannot be created, chose a different one” issue is that the real path to your workspace may have changed.
In my case, the real location of the workspace had changed, but I had used a symlink to make it look like it was in the same location. I saw errors in logs indicating that eclipse was looking at the previous "real" location, as opposed to following the symlink, and this was causing the errors.
In my case, I just moved the workspace back to its old location.
There is another case where the path to the workspace may not exist, e.g., if you have imported preferences from another workspace, then some imported workspace addresses may appear in your "open workspace" dialog; then if you didn't pay attention to those addresses, you would get the exact same error once you tried to open them.
Running eclipse in Administrator Mode fixed it for me. You can do this by [Right Click] -> Run as Administrator on the eclipse.exe from your install dir.
I was on a working environment with win7 machine having restrictive permission. I also did remove the .lock and .log files but that did not help. It can be a combination of all as well that made it work.
deleting logs and .lock didn't work but
-clean option fixed it for me.
At times, if you are on Windows, you may not see all the processes - or the culprit process in Task manager. I had to click 'Show process from all users' and there was this java.exe that I had to kill in order to get back my workspace.
Another possible case if none works is to see that there is a running Java application . may be your previous open and close has left unkilled java instances.
Do look for any java instance is running if there are two at least you need to kill one.But ,most of the time i kill any java running :) because that java is using the work space earlier and still will if don't kill it.
Change another work space in case if you want a multiple IDE to use and work on diffrent or same project , but you should import project form workspace after you open your IDE.
i was faced this issue when ever the eclipse is not closed (kill eclipse process the from task manager or computer power off), i was tried below steps, it worked for me.
1) Remove the file names start with ".fileTable" from this folder
C:\eclipse\configuration\org.eclipse.osgi.manager
2) Remove the log files like text files start with numeric names from this folder
C:\eclipse\configuration
3) Open Command prompt(cmd) navigate to this folder
C:\eclipse
type below command
eclipse clean start
For Mac Users:
It could be that another instance of eclipse is running in the background. If so, use either Force Quit eclipse or
ps -ef |grep eclipse
kill -9 pid
to all the eclipse instances, and start the new workspace
Start Eclipse with the option -Dosgi.locking=none.
I got the trick here and it works.
Don't do this unless you know nobody can work on the same file at the same time.
PLease try to end task Eclipse from taskbar. It works for me.
The answer #Boris gave is correct 99% of the time, however it can also happen if you open the workspace in an older version of Eclipse. A workspace imported into/created with Juno will throw this error when opened in Galileo.
Another all-too-common reason for this problem is if you attempt to load a directory on a drive that is no longer connected. For example, Say you program in C:\Code\Java, but occasionally work off of a flash drive, H:\Code\Java. If you do not have the drive connected it can be easy to believe you are trying to load a valid directory without noticing your typo.
Another problem is when eclipse doesn't have write access to your src folder. Change the security permission and make sure "Authenticated Users" are added with all permissions checked but Full Control & Special Permissions.
I had this error after I restarted the system (after a long time. Normally I just make it sleep).
Found out that once I mounted the drives (by clicking and opening it) where project folder is located, and relaunching eclipse, solved the issue for me.
PS: I'm an ubuntu user.
Here are a few steps to solve it the no. 4 step is works for me.
Delete .log files along .metadata folder.
Check the current user permission make sure to check the full control checkbox click apply then OK.
If you run system drive defragmentation or maintenance before you run eclipse editor sometimes original file path are not in their respective path to make sure run "previous version" time before your system maintenance of your drive where the eclipse workbench or something similar to this was saved.
This last option is works for me.
Check the drive letter of your current drive where the code editor was saved. If something unusual e.g before your maintenance your drive letter is K then after defragment or maintenance.
The drive letter is now L hence you should change the drive letter to its original one that is K.
to do this click the ff:
Open control panel
System & security
Administrative tools
Computer management
Disk management
in disk mngt choose the Drive example L
then right click > change drive letter & path > click remove > then ok, open it again then > click add and > choose your original drive letter for that drive then click ok. If you use your computer for a long period of time do restart first to refresh everything.
Choosing a "different one" is actually a pretty easy solution.
I had been running Eclipse as an administrator (sudo eclipse from the command line) because the "workspace" folder was throwing the Workspace in use or cannot be created… error (and running as administrator seemed to be the only solution that fixed it).
A coworker (working on this same issue with me) wanted to run Eclipse by clicking on an icon. So when he ran Eclipse, and the dialogue box came up with the choose your workspace, he just added a "2" to the end of "workspace".
This created a new folder: "workspace2". Eclipse ran fine with that; and I haven’t had any of the locking problems since.
It will occur when you not closed eclipse.exe correctly.
*Open Task manager->End task your eclipse->Now open eclipse.exe it will work.
Hope its help someone.
I have observed one case when eclipse when in forced quit, or Alt-f2 xkilled in linux, an attempt to immediately open eclipse shows that error. Even the metadat/.lock file is not present in that case.
However it starts working after a span of about two minutes
I don't know what's the wrong but I solved by creating a directory directly in c drive(c:\dev) instead of from my home folder (c:\users\me\dev). But I don't have to thinks about it. In my case, it is fresh eclipse unziped instance. I am not able to see .matadata folder in eclipse folder. By God grace, I solved.
The reason this was happening to me (with Photon) was easily fixed by changing an Eclipse general preference:
Window -> Preferences -> General: Uncheck: "Always run in background"
Once you make that change, whenever you shutdown Eclipse, it will no longer leave the javaw.exe process running in the background. I’m guessing this is a bug in Photon (or a bug with using the Amazon Corretto OpenJDK version of Java with Eclipse) that will one day be fixed.
I faced the same problem, but for some reasons the .lock file in workspace was not getting deleted. Even creating a new workspace was also getting locked.
So what I did was cleaning the windows temp folder, the %PREFETCH% folder and %TEMP% locations. Restart the system and then it allowed to delete the .lock file.
Maybe it will help someone.
It seems your workspace is used in Java TM, Open task manager and close eclipse.exe and java TM process.
What worked in my case was restarting the system. (ubuntu 20.04)
If anyone have come here with a STM32Cube related issue, which apparently is based on Eclipse and has the same problem, none of the above suggestions worked for me, and here is how I fixed it, for Linux, although I suppose you can find the corresponding paths in Windows as well.
In the $HOME directory, go to .eclipse/com.st.stm32cube.ide.../configuration/settings
The file org.eclipse.ui.ide.prefs contains few options including the recent workspace path, and whether it will prompt you to select a workspace at the startup. Either modify the path for RECENT_WORKSPACES, or enable SHOW_WORKSPACE_SELECTION_DIALOG.
In my case, there was a space right before the workspace's location C:\. I removed that space and it was enough :)
Can someone explain how Eclipse's local history works?
I accidentally overwrote a file in a project but need to revert to an earlier version.
Is there a chance that Eclipse has the older file cached somewhere?
To complete CurtainDog's answer: from eclipse FAQ
Every time you modify a file in Eclipse, a copy of the old contents is kept in the local history. At any time, you can compare or replace a file with any older version from the history.
Although this is no replacement for a real code repository, it can help you out when you change or delete a file by accident.
Local history also has an advantage that it wasn’t really designed for: The history can also help you out when your workspace has a catastrophic problem or if you get disk errors that corrupt your workspace files.
As a last resort, you can manually browse the local history folder to find copies of the files you lost, which is a bit like using Google’s cache to browse Web pages that no longer exist.
Each file revision is stored in a separate file with a random file name inside the history folder. The path of the history folder inside your workspace is
.metadata/.plugins/org.eclipse.core.resources/.history/
You can use your operating system’s search tool to locate the files you are looking for.
Note, if your need to import your local history into a new workspace, you will need both:
.metadata/.plugins/org.eclipse.core.resources/.history
.metadata/.plugins/org.eclipse.core.resources/.project
to have a functional local history in that new workspace.
Try right-clicking on the file in eclipse, and choose Replace With->Local History.
If there's history available, it'll show up as a list of edit times.
But more importantly, as pointed out in other answers, be sure to put your files in version control! SVN is pretty easy to set up (you don't need a server; it can just use the file system); use it even if you aren't sharing with others.
A tip: whenever you hear yourself say "yes!", check in all of your code. 10 minutes later, you'll be saying "how did I mess that up?"
If you have lost a full package structure due to accidental deletion or svn/cvs override, select the project> right click> Restore from local history => select the files.
VonC's answer has all the information you need for finding the location of your code backups. I would simply add that if you are on a Mac or Linux, you can do something like this:
$ cd [WORKSPACE]/.metadata/.plugins/org.eclipse.core.resources/.history/
$ grep -rl "class Foo" . | xargs ls -lt
This will find all the versions of a file that contains a particular string (ie. "class Foo"), and sort them by date/time to easily find the most recent version.
You can use the link http://wiki.eclipse.org/FAQ_Where_is_the_workspace_local_history_stored%3F is very helpfull
Open the CVS view and you should see a filter for local history. You should then be able to right-click on the correct version and Get Contents or do a manual compare and merge. I'm not sure what the eclipse defaults are for keeping local history but there is a decent chance you'll be able to get your stuff back if you act quickly.