My android project in Eclipse disappeared? - java

I wanted to create .apk file from my Android project in Eclipse, so I klicked on File --> Export --> Export Android Application. I filled required fields and I clicked finish. After that I received an error and all my application files disappear, I only have a file called "gen [Generated Java Files] and I cant open it.
I tried to search my app files manually in Windows Explorer but all is gone...
Now I don't have app files and even .apk
Where is my application?

Try to look for it in your workspace directory.
If you don't know where that is, click File > Switch Workspace, and you'll be able to see the location.
Or you could go to:
\eclipse_directory\configuration\.settings\
Open org.eclipse.ui.ide.prefs with a text editor (e.g. Notepad).
Look for RECENT_WORKSPACES. You'll find the location of your workspace there.

Just use Free Recovery to recover your deleted file.
Try it soon before anything write on that disk sector.

Related

Eclipse is not showing warnings or errors when a Java source file is opened that is not part of a project

I have a Java source file, and in Eclipse I click File -> Open File and select my file.
The file opens fine in Eclipse and is syntax highlighted, but when I remove a semi colon or try to use a variable before declaring it, Eclipse does not show me any errors etc
Is this possible? Without having to create a project
You need the project nature "Java" enabled if you want your file to be treated as Java code. You can create a new "Java project" and drop your file into the src folder. If you have already a simple project try to convert it to a faceted project using the properties dialog and enable facet Java.
Look in the .project file, with the navigator view or directly on disk, and check org.eclipse.jdt.core.javanature is present.

How do I save and email my .java file? (beginner)

Java beginner here. I am using eclipse and my professor wants us to email our file as a .java. I can't figure out how to export the file without turning it into a "JAR" file. When I click save as, eclipse only gives the option to save it to src folder. Please help!
You can find the .java file of your project by locating the src folder of the project you are working on.
Assuming you are using the default workspace location it should be saved here:
Go to C/Users/[You]/eclipse-workspace/[project name]/src/
If you have changed your workspace location it will be saved in that location and you can get the .java files by opening the folder, choosing your project and going to the src folder.
Milen Patel already gave you a working answer but instead of just navigating through your PC with Windows Explorer you could instead rightclick on the Class in Eclipse you want the Java file of, go to the 3rd point from the top (Show in) and go to System Explorer. Eclipse will automaticaly open it. (For people who like shortcuts, do ALT + SHIFT + W)

Intellij Tree with custom files in plugin

I'm developing intellij plugin and I have tree structure with files and directories (not related to current project nor file systems). Is is just some virtual tree structure provided by rest service. I want to display it in ToolWindow with all common staff like colors, file type icons etc.
Is my usecase already supported by intellij?
Which classs support this?
The closes one related to my case I found trees from vcs package but it is commit / change related.
I don't think what you want to do is formally supported by JetBrains, but you could create a "fake" project in Intellij IDEA as long as the files and directories you want to appear in the tools (Project) window have a single parent directory.
I had a folder named "docs2" which contained some random notes and documentation files of various types such as txt, pdf, zip, html, js and bak. I opened that directory as a project in Intellij IDEA's Project window as follows:
Create an new project: File -> New -> Project... -> Static Web -> Static Web, then click the Next button:
On the next screen populate the Project location field by navigating to the folder containing the files you want to open in Itellij IDEA, and give the project a suitable name. Then click Finish.
After that Intellij IDEA will treat the directory as though it was a static web project.
Notes:
Intellij IDEA won't necessarily be able to handle all of the project files created in this manner. For example, when I opened a pdf file it was opened in another application, and when I tried to open a zip file nothing happened. But other known file types such as *.txt, *.html and *.js can be opened and edited as though they were files in a "real" project.
When you open the directory as a project Intellij IDEA will create some files in that directory: a *.iml project file and a .idea folder containing configuration files, so you will need write access to the folder that you open as a project.
I also tried opening the directory as an Empty Project in Intellij IDEA, but that only worked partially; files under the parent directory were shown, but for some reason it would not show any sub-directories in the project.

How to make eclipse recognize the correct file extension/open the correct editor for files opened outside of the scope of a project?

I have a simple file index.jsp outside of a project in a location such as /home/user/other/ and I open it in eclipse with File - Open file. The file opens but things such as content assist are not working.
I tried creating a file inside an eclipse project (with File - new - jsp file) and everything works (including content assist).
Is there a way to force eclipse to open the proper editor for files opened outside the scope of a project?
Edit: I'm running eclipse indigo for java ee.
There seems to be a problem with the file not being in a project. I tried moving the file inside a project and now it works. I still want to know how to make this work outside a project though.
Are the file associations set correctly in your eclipse version?
This can be done under Preferences -> General -> Editors -> File Associations
You can set the desired editors for each file extension there. You can also set multiple editors for file associations. In that case you should set the default associated editor to the desired one.
When the default editor is set to your desired one, it should open files from outside of your project with this one.
For JSP files specifically, Java content assist will not work outside the workspace since it relies on a project's Java Build Path (you'll find the same limitations opening .java files). This is normal.

How do I save Eclipse launch profiles across workspaces?

When I copy an Eclipse project directory, it contains the .classpath and .project files so that when I take that same directory to another Eclipse instance, I don't have to setup my build path and such (assuming that all the resources are contained in the project, and not external.)
However, this procedure doesn't cause launch profiles to "travel" with the directory.
Is there some other file/directory structure I can "carry around" to another instance of Eclipse that will include my launch profiles?
The .launch xml files (launcher definition) are found in
[eclipse-workspace]\.metadata\.plugins\org.eclipse.debug.core\.launches
Just copy them into your <project>/.settings directory.
Refresh your project, and there you have it: those launcher configuration are available, and you can copy them along the rest of your project files.
Warning: do uncheck the option "Delete configurations when associated resource is deleted" in the Run/Launching/Launch Configuration preference panel: it is common ot soft-delete a project in order to import it back again, to force a reinitialization of the eclipse metadata,... but this option, if checked, will removed your detailed launch parameters!
See also Which eclipse files belong under Version Control, and where are the external tools launch configurations in Eclipse.
Jared adds:
There is no .settings directory in my project directory - I created it and put the .launch file in there, refreshed my project, and it doesn't have any Run profiles. Do you have to mirror the directory structure under .metadata?
Just create the .settings directory (it is actually created when you have project specific settings as illustrated in the question "Maintaining a common set of Eclipse preferences").
Then delete the same .launch file from the .metadata directory.
Then refresh your project and go to the "Run Configurations" Panel: you will see your launch configurations still available, except they are stored where they belong: within your project directory and not buried under an obscure workspace metadata thingy.
Update June 2012
I always seen my launch configurations, saved under PROJECT_LOC/.settings, automatically imported when reloading the Eclipse workspace.
However, as described in "Tip: Creating and Sharing Launch Configurations (2007)", you should be able to reference a launch configuration saved into any subdirectory of your project if you go to the "Common" tab of your "Run Configurations" wizard.
So saving your launcher anywhere in the project won't display them automatically in the "Run Configurations" section of the preferences.
But declaring a new one, sharing its launcher as a "Shared file" (as illustrated above), and then overwriting that launcher with the actual one you had previously saved would update that run configuration.
Try choosing a shared file location inside your workspace from the "Common" tab of the launch configurations (profiles).
Depending on the amount of moving around you do and the number locations you move to, storing your launch files in an online storage space and then setting up folders at the new locations to synchronize with it may be a viable solution.
Dropbox
is a decent online storage system that gives users up to 2 gigabytes of storage.
Here is an example of how you can synchronize folders out side the Dropbox folder curtiousy of
LifeHacker.com :
Use either the JUNCTION utility from Sysinternals, or the MKLINK command built in to Windows Vista and Server 2008, for example:
junction "C:\Documents and Settings\User\My Documents\My Dropbox\DesiredFolder" "C:\Path\To\DesiredFolder"
mklink /D "C:\Users\Steve\Documents\Dropbox\DesiredFolder" "C:\Path\To\DesiredFolder"
Or, if you prefer a GUI, install Link Shell Extension.
[eclipse-workspace].metadata.plugins\org.eclipse.debug.core.launches
would be the DesiredFolder.
You could also use SyncToy to echo changes from another folder to your Dropbox folder. This keeps 2 copies on disk though.
On OS X or Linux, try the following:
Use the ln command, for example:
ln -s /path/to/desired-folder ~/Dropbox/desired-folder
This works with files too:
ln -s /path/to/desired-file ~/Dropbox/desired-file
Another easy way to do this with Terminal is type the ln -s part, then from Finder drag the folder/file that you want into the Terminal window then drag the Dropbox folder and hit return.
Note that an Alias file or folder does not work.
Another solution could be to keep your launch files in an svn repository. Search for How to run Eclipse launch configurations programmatically? on this site. Sorry can only post one url so I used it on Dropbox.
There is an another clean way to share the launch configurations in Eclipse.
Create a java project. For instance lets name it Launches-Configs.
Now create a new Run Configuration for a project that you need to
run.
On the Run Configurations window navigate to Common tab. Ensure
Shared File option is selected and input the Shared File location is set to
\Launches-Configs\src
Check in Launches-Configs to a VCS and share with other teams
I have had good use of creating a /launch folder, and then setting the launch configuration to be "Shared file:" (the Commons panel) to the above mentioned launch folder.
The resulting launch file can be checked into e.g. CVS git and be pulled into a fresh workspace.
Create a Launch Configuration with Shared File option selected under Common Tab.
This will create a configuration file with .launch extension.
Now in another workspace just go to Import and select Launch Configurations, choose the configurations from the directory and finish.
It will appear in the Run configuration now.

Categories