Eclipse: Issues with deleting and creating projects - java

I am having an issue in Eclipse. If I create a project, then delete it and check the "Delete project contents on disk (cannot be undone)" check box, a project created afterwards with the exact same name and settings will not be created with a MainActivity.java file.
If I create a project then delete it without checking that box, it can be recreated with the MainActivity.java file but will require you to open and save the fragment_main XML file before the project can be deleted again (with or without checking the check box).
What is happening here? Why does it behave in this way?

#Zach H
When deleting a project give you two options(The dialog box will ask your confirmation for deleting from workspace or not)
Simple Delete
Delete from workspace
Under simple delete-
As you delete a project then the project gets deleted in the Package Explorer but is still present in your workspace directory (i.e. the path where your projects are stored) because you didn't select delete from workspace option.
Under Delete from workspace-
When you confirm the option delete from workspace then you project gets deleted from your hard disk as well.
When you simply choose delete then you can create a same project with same activity because the project with same name is not there in the package explorer. Only if the same project already exists then you will get an error asking you to rename your project.
The above said problem happens only when you have not installed the ADT/Eclipse properly(missing some files from the SDK Manager).
My suggestion for you is that you first install all the packages from the tools because a missing support tool could coz such problem as above

When you delete a Eclipse project this is what happens:
If you choose delete on disk - You delete the project and the files from the PC.
If you don't choose delete on disk - You only delete the project from eclipse but the files still there, so if you create a new project with the same name them put automatically.
For this case when you need some files from old projects,
So, the best way is import or export projects.
I hope this help you.

Related

Deleting Java project and then creating the same one in the same directory - Eclipse

I'm having difficulties creating a Java project in Eclipse on the same location where the deleted project was. What happens when I change the new project location to the one where the old project was is all my options become grayed out. I cannot select the JRE or change the project layout. I cannot pick whether I want to create module-info.java file or not. It seems like Eclipse somehow knows there was a project on the same location. If that is the case, how can I delete Eclipse Project creation history?
New Java Project dialog info message:
The wizard will automatically configure the JRE and the project layout based on the existing source.
When you delete a project in Eclipse, you get a dialog like this:
As you can see, the default is that the project content is not delete, only the project registration in Eclipse.
Since the actual project files are left on disk, you can "import" the project back into Eclipse, using File > Import....
When you try to create a new project, but select a folder on disk that already contains a project, the "Create Project" dialog automatically becomes an "Import Project" dialog.
If you don't want to import that project, either select another folder, or delete the folder first.
Next time you delete a project, check the Delete checkbox, so all the project files and source files are deleted too.
Make sure you have deleted all the hidden files in the directory.
Make sure it's deleted on your machine in your file explorer. If it's not deleted correctly it can still be save on your machine.

Error "MANIFEST.MF already exists in VFS" when creating new artifact

I have a Java project that I used to be able to build artifacts from, but now I am unable to.
First, my project was building and I was able to create artifacts, but on running the .jar I was getting "Java Exemption Error". I checked to see what version of the compiler I was using (1.8) and made sure my machine was up to date.
Next I tried to fix any dependency issues by deleting and re-associating some of my external .jar files.
Then I deleted the artifact setting and tried to create a new one. Now I receive a
.../MANIFEST.MF already exists in VFS
error when trying to create a new artifact.
I'm using the latest version of Intellij.
My source code can be found here: https://github.com/mjtik/PiccoApp.
I can provide screen shots if necessary.
*I have created many .jars in the past, not sure what changed in my project.
Any suggestions or guidance would be appreciated.
I solved my problem. Ever step I took lead me to the solution. The problem was with how I was creating the new artifact.
When creating the new artifact, I selected JAR and then a popup window displays default settings. It has me app module selected and the main class below is blank.
I was selecting the main class and it was producing an error. When I just accepted the default options left the main class blank, the artifact was created.
Another solution would be to just :
Navigate to $HOME$\IdeaProjects\ProjectFolder\src\META-INF and delete the MANIFEST.MF file in there.
Restart IntelliJ Idea
Go to Project Structure > Artifacts -> delete your project artifact setting
Add new artifact setting and reconfigure as required.
I inherited a project which already had the MANIFEST.MF file in the META-INF folder in the src folder. But this project did not have a artifact configured in the project structure dialog box. I also don't think that deleting an existing file and restarting Idea is an ideal solution for this problem.
I've listed below the steps that worked for me and these were done on Intellij Idea 2016.1.
Step 1: Choose Empty when you want to add an artifact to create a JAR file with an existing MANIFEST.MF file. Do NOT select From module with dependencies as that will lead to the error described in the question.
Step 2: In the next screen, select the Use Existing Manifest button to navigate to and select the existing MANIFEST.MFfile. Make any other changes you need now so the JAR artifact is created per your needs.
Step 3: Select OK and you should be all set now. Depending on whether you selected build on make and make your project or if you specifically generate the artifact, your JAR would get created without any issues.
I use "create artifact from modules". If I get the notification for the manifest that exists, I delete the manifest file, then do "invalidate caches and restart". I think Intellij is complaining about a copy of that file that's in the cache.

how to import-back a deleted project from same eclipse workspace

It looks basic question but i don't have solution,
Long back, I soft deleted(physically project in workspace directory) from eclipse workspace.
I am trying to import that project now. It is saying project already in workspace.
So I am doing copy that project from workspace to other location and, deleting that project from workspace. And importing that project to workspace back. This way, It working fine.
But do you have any better idea than this....
If you deleted the project from the disk your best bet would be to restore it from the recycle bin. Otherwise you might need a data-recovery tool.
If the project is completely deleted and you're still getting the "already in workspace" message, check your projects folder. You might have a similarly-named project that was deleted from Eclipse but not the workspace folder.
Go to import, then import existing project , and select your project folder present on the disk, Now this is important , Uncheck the copy projects into workspace checkbox, and then click refresh button. Now you will be able to import the project.
Edit:- This will work assuming you deleted project with default settings, which means the checkbox Delete contents from disk was not selected , and the files are still present on your HDD.
Go to import, then click on "General->Existing Projects into Workspace" , then select your project root directory present on the disk. Make sure the project folder path is correct. Unchecked all the "Options" checkbox.
Simply delete from hard disk where it previously belong and you are done.
Now try to Import it from anther copy (external source).

Eclipse Hell . . . Failed to read the project description file (.project)

I think Eclipse is trying to make me miserable. A couple of hours ago, my project was working and compiling well. Suddenly that all changed. Eclipse somehow wipes out all changes I have made to my files(activity, manifest etc.) I make sure to save often but when I go to run the project, I get the error that I have a build error. I checked and there was none, so I go to close Eclipse, so I can reopen and see if the errors will go away. Instead what happens is Eclipse wipes clean all my files and I end up with a project on disk with lots of blank code files. I try to run anyway, and I get the error message below.
Failed to read the project description file (.project) for 'com.example.android.nfc.simulator.FakeTagsActivity.FakeTagsActivity'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.
Anyone have an idea what in the world this is about and how I can rectify this?
I would recommend to wipe out all the eclipse related configuration files(make sure you take the backup if you have manually made some changes in those) and import the project again, by following
File -> Import... -> Existing Project into Workspace
Make sure you take the backup of whole project before doing this.
When Eclipse gets stuck in some obscure status, I usually find useful to recreate the .metadata folder in workspace directory. It is a drastic solution, but it usually works for me. After that you can reimport all your projects.
This happened to me because I had a conflict in my .project file. I opened it up in a text editor and fixed the conflict (in my case, removed from ====... to >>>branch..., as well as <<<HEAD) and then I was able to open the project in eclipse.
I was just encountering this same issue (using Zend Studio 12, which is built on Eclipse). My problem was that I was creating a project from a Remote Server, and I was just downloading everything, which also included the .project file from the old project. It wasn't showing this error until I'd closed the program and tried to open it again (which usually wasn't until the next day).
I seem to have resolved it by making sure not to download the .project when initializing the project.
If the .project file is a text file, so if you have it in version control you might want to copy it over from there.
Before you trying the following make a backup of your current project state.
Assuming you don't have an old copy, you can open it in a text editor and try to see if there is something obvious wrong.
If this fails, copy the source files of your project to a fresh location (without the eclipse configuration files) and import it as a new project into eclipse.
if you still have all of your other source (.java files, AndroidManifest.xml, resources), you might be able to get your project back by simply going to the folder containing the project, removing the .project file that you say is now empty, and then using the new project wizard to recreate the project (and .project file) for you from your existing tree of source.
from the menus, select File -> New... -> Project , and then, in the first dialog, choose Android Project from Existing Code .
if you had done anything special to the .project (reliance on specific .jar files or changes to classpath), you may have to re-do these steps after you re-create your project; but at least it should pick up the code you already have.
If all the files are empty, and you have no working Backup, I can't help. I would recommend to use proper version control in the future.
Use git or mercurial, they have nice UI integrations (see tortoisegit/tortoisehg).
To decouple the build process and library management from eclipse, take a look at maven or gradle, this might help you in future projects.
If you use git, complete the merge e.g. del the head in your androidmanifest.
I also got the Same Issue in Eclipse but the real problem is i removed the actual Source project folder from source location (from which eclipse is trying to take the project) to some other place hence my eclipse is unable to get web.xml file since it is not available. Now i changed my source project folder location to the path where eclipse is trying to search for. Issue Resolved for me.
Just delete the 'servers' folder in your workspace and try again.

Automatically deleted project in Netbeans

For the reasons of electricity my computer has shut down. That time my Netbeans project was running. I built up this project a few minutes back. Starting up the computer, the Netbeans project source file is gone. How can I retrieve my project files?
You should have the project in the NetbeansProject folder.
Use open project button and it should put it back if the sources and .project are there.
So, if nbproject folder exists then you can open the project. If the src is there then you have the source files. If not you might be screwed. That's where SVN is handy.
If they are gone, then it depends on the sensitivity and importance of the code. You may need to pay a service to extract the bits from your hard drive if they are even still there.
Have you tried to select (highlight) the project that contained the ZIP file. Under Versioning, select Local History -> Revert Deleted and see if your ZIP file comes back.

Categories

Resources