Files disappeared, could be related to Eclipse - eclipse

I have lost files mysteriously a few times from my Eclipse workspace folder, and previously I assumed that I must have deleted them, but this time I know for sure that I didn't.
I entered a folder for a Java project. I listed the files. There were several text files. I then opened one in gedit to look at it. As far as I remember, I then did something in libreoffice Calc (to a spreadsheet file in a completely separate location), then I made some changes to the Java file in Eclipse. It would then have been automatically compiled. I then went back to the terminal to execute the program, but it wouldn't run. Listing the files shows that the reason it wouldn't run is that all the text files have disappeared and so has one of the .jar files (called stanford-parser.jar) but not another. I've searched my computer for these files and I can confirm they've gone.
A screenshot from my terminal illustrates this.
Can anyone help me to understand how this is happened, so I can avoid it happening again? Could compilation delete the files?

You seem to be storing source files in the bin directory of your Eclipse project, which is probably the target directory used by Eclipse to put the compiled classes. Store your sources in the source folder. The target folder is completeley deleted by Eclipse each time the project is cleaned up.
Note that non .java files stored in the source directory are automatically copied to the target directory by Eclipse. They're considered as resources that must be available at runtime in the compiled application.

Related

How to export Intellij project as Eclipse archived folder

My professor wants all assignments submitted as an archived folder and wants the program to be able to run on his Eclipse when he grades them. The program is a simple one with one folder that has to contain just one class with the main method.
I am using IntelliJ.
I followed Jetbrains faq on exporting files as Eclipse-compatible using Files --> Export : https://www.jetbrains.com/help/idea/exporting-an-intellij-idea-project-to-eclipse.html
It looks like the files were successfully converted as my folder directory looks similar to what the website. A screenshot of my directory after exporting: https://imgur.com/a/qQY4lUH
I am not sure what to do here as I am not familiar with the Eclipse ".classpath" and ".project" files that were created as well as the .eml and .iml files. I don't know what to do with them.
I was thinking of just copying them into a new folder called "ReviewNW" and archiving them and submitting that folder. I don't know if that would be enough for Eclipse to run my program. Is there something else I have to do from here?
Additional question: I have since changed some things in my program. Now when I try to use File --> Export, IntelliJ gives me an error and says I "cannot export files already exported to eclipse-compatible format". What if I make some changes to my class files in my src folder and need to export those changes again? I think I would need to manually delete each of those Eclipse files and export again or is there a simpler way?
Thank you!

Version 8.2 difficulties

I upgraded to version 8.2 and my projects list disappeared. When I pointed to the folder where my java files are located, Netbeans cannot find a project file. However, in the folder reside my 2 java files and a form file.
Admittedly, I do lack a bit of Netbeans experience, and for the life of me, I cannot figure out how to import these files into a project - and be able to work with the form. Can anyone give me a pointer on how to resurrect my project?
Edited at recommendation:
When I selected "Open Project" and entered the path to where my files are located "/Users/robertbray/Documents/Robert/NetBeans/numberaddition/" In the "Project Folder" pane, nothing appears, as if the project does not exist. So, playing around this evening, I used the "Open File" method and entered the path "/Users/robertbray/Documents/Robert/NetBeans/numberaddition", now I am able to see my source files (NumberAdditionUI.java, NumberAdditionUI.form, and GraphPanel2.java) and I can open them, including the form (design). However, I cannot determine how to convert this to a project file so I can build and run the code - these options are greyed out.
Since I had the original source files, I created a new project, then moved (and renamed) the original java class/form files into the "/src" directory. Of course I had to do some changes in the java files with the new name. As s test, I modified the form and rebuilt the project. Working as expected. Many thanks to #skomisa!

java - Eclipse Helios SR 2 Package explorer error

I need help. I was starting to work on a new project in Eclipse and so I decided to rid my package explorer space of any past projects within the IDE. I had 2 projects saved prior to opening the IDE: "new" and "project 1." I proceeded to delete project 1 successfully from the IDE permanently without any issues so I tried to delete "new." "new" was a project directory saved on my desktop and upon deletion within the IDE by right clicking, it deleted random files and folders on my desktop as well as other files I'm not aware of within a second, completely bypassing recycle bin-around 50GB of files. I tried to recover most of the files but they are fragmented and therefore damaged. Is this behaviour normal in Eclipse?
Basically in eclipse when you create a project, you create in a workspace. By default the project gets stored in the work space folder. However you can give a specific directory to save your project
The work space folder will usually have information regarding the projects. In eclipse we have 2 kind of delete. i.e.
1) Logical:- Project will get deleted from work space but there wont be any actual delete of files.
2) Physical:- Complete deletion of project.
I guess you would have opted the second one and the project would be corrupt. May be it had some dependent files outside which got deleted also.
usually when I want to remove the project , I go for soft delete. When I completely want to remove the project then I browse and delete the project folder itself.
You can find other related help regarding Eclipse in
http://help.eclipse.org/indigo/index.jsp

Eclipse (files are deleted)

This is not the first time that happens. Yesterday I code the whole day. In the end of the day I saved everything and close Eclipse.
Today, I open Eclipse and all of my classes are gone. My folder of classes is inside of "gen (Generated Java Files" folder. Is that the problem?
I know how to restore the files..but they come with errors and I have to correct the entire classes - they are about 10. What am I doing wrong?
Im not sure but try with creating a folder workspace on your C: directory and save them there
Try following: ( This may be helpful)
Copying the .class files to a separate folder. (So won't loose them)
Try to find backup using time capsule or any other way.
Either able to find backup for all or fail.
After this Decompile java class files : Decompile Java Files

Does Eclipse store all workspace files somewhere else?

I'm often surprised that Eclipse is giving error during search "File is out of sync with file system", for the file that I have not even opened. I have a large workspace with hundreds of files under SVN control. I have configured Eclipse to "auto-refresh" on load to minimize such issues.
I can't stop wondering how can this happen at all? Why does it need to "refresh" if it should (at least I expect it to) just load everything from file system?
It looks like it's storing all the files somewhere (not even in memory, having a need to refresh on load), and if it's true - I don't like it.
Eclipse does not store your files anywhere except your workspace directory and does not use the file system directly every time when you need some files.
Eclipse indexes/caches different meta-information for all projects and theirs files in your workspace. The information can be found under .metadata folder of your workspace directory.
Such information is used to provide the tree of the files to the Eclipse and show resources in views such as Project Explorer, Package Explorer etc.
The main reason of such behaviour is performance purposes.
The out of sync problem appears when:
you create files manually (out of the Eclipse) in your workspace
Eclipse plugins or processes create/update/delete/etc. files improperly i.e. do not call related Eclipse API to refresh the resources and update the indexes.