Possible to have several instances of Eclipse open simultaneously? - java

I'd like to know if it's possible to have several instances of Eclipse open at the same time. I'm using it for Java development. I know I can have several files from different projects open at the same time (at least that's what it seems to me), but whenever I try to open a second instance it shows me the following message:
alt text http://img46.imageshack.us/img46/5033/sxbz3mti34afybrafhc32m0.png
Is there any easy way to have several instances of Eclipse open, each one with a different project?
Thanks

Either create multiple workspaces (Preferences / Startup, tickbox to ask which on every startup)
Or more likely, I think Window / New Window will open a second eclipse viewing window on the same workspace.

yes, each on a different wokspace.
Projects and Workspaces in Eclipse are different. A workspace has a set of global settings and then it has a set of projects.
There are two kinds of project. Projects in the workspace and projects outside the workspace. If you use in the workspace projects (for example, by telling eclipse to make a project via a source control checkout), then it can only be in that workspace.
If you create projects outside the workspace, then you can import each one into as many workspaces as you like.
You can make as many workspaces as you like. Each workspace can be open in only one instance of eclipse.

A better answer to have only the resources from certain project in the new Window is by right clicking the project and select "Open in New Window"

You may want to use Working sets.
A common problem in Eclipse is that
your data in your workspace grows and
therefore your workspace is not well
structured anymore. You can use
working sets to organize your
displayed projects / data. To setup
your working set select in the Package
Explorer -> Show -> Working Sets.

I tend to use different workspaces for different contexts, not just working sets. For that none of the answers above is satisfactory, instead you might want to use the "-data" option on the command line. That allows you to specify the workspace to open, if that is different from the already open one, then a new Eclipse instance will be started.
See http://labs.distriqt.com/post/844 for more details.

There is a way. I have several installations of eclipse in separate folders. Each setup for a different language/job and perspective (CF, Java, Birt). Each has its own workspace so they don't interfere with each other. You can work out if your machine can handle the multiple instances.

If I understand well, your problem is that you would like not to see the other projects while working on one. What you could do is close the projects you're not working on, and then in the package explorer, choose filters > closed projects. This way the closed projects no longer appear in the package explorer.

If you want multiple Eclipse instances open on the same workspace (with the same projects) then you want to use 'Window > New Window'. This will even let you drag views from one window to another.
If you want to display different sets of projects in each Eclipse Window then I'd suggest you use set up a 'Working Set' for each combination of projects you want to work with. You can then select a specific working set from within the Package Explorer. You can create working sets using 'File > New > Java Working Set'.
Something else to consider is that a Workspace is more than just a group of projects - preferences are all stored at the Workspace level. This means that it is quite easy for your preferences to get out of sync if you work with multiple Workspaces.

Related

How to add same perspective in Eclipse in Other Projects?

I have saved a custom perspective in one of my projects and now I want to use that same again in my other java project but upon looking for perspectives category, my custom perspective is not showing up in the new project but is visible in the previous project.
I want my perspective to applied on all java projects which I ever I open automatically.
Is there any way we can export our perspective to a file format (like XML or something which eclipse can read on importing it again) and upon working on new project we can simply import them using the export file.
I don't know any solution to it but I have attached images for your references:
Java CP 2 is my custom perspective but it is not visible in another project.
How can I do something so that it is visible globally (in my IDE) and at present, I have to manually set up a perspective for each project I open.
Screenshot 1 - Java CP 2 Perspective
Screenshot 2 - Java CP 2 Perspective is not present

Eclipse workspace vs. regular directory

Note: I don't find this being a duplicate of any question. I have done a lot of research on this (few hours, read whole Google about workspaces probably - it's a metaphor of course) but couldn't find the answer to my problem.
So I have done some programming in Java and mainly used Eclipse for it (when projects were getting more complex, before I had used Vi). I was always working in that default workspace $HOME/eclipse-workspace because I never really understood the point of workspaces.
I am back to programming in Java, installed Eclipse and get prompted to Select a directory as workspace which kindly offered me to use /home/campovski/eclipse-workspace. Before I would just hit Launch but now I started getting curious. What are these workspaces, what are they used for...?
I have done some research:
Eclipse Workspaces: What for and why? (SE)
Eclipse - Workspaces (Tutorials point)
Documentation
I also followed the links that were provided in answers to the first link but none gave me the answer to my question:
What is the difference between a directory and a workspace?
As is stated in third link: A workspace can have any number of projects, each of which can be stored in a different location in some file system. Ok, this might be useful, but what is the problem of including all projects in one parent directory which could serve instead of a workspace?
If we take Matlab for example:
There you have a directory selection menu on the left, just like in Eclipse. The current directory you are in is selected as a working directory and any Matlab function and scripts declared in this directory can be executed in the Command Window. The analogy from Eclipse would be as to import a function from different folder.
So my question to rephrase it is, is there anything else to workspaces than workspace just being a collection of projects, folders and files, just like a normal directory, except that in workspace there can be projects from different paths.
Workspace it's like user's homedir in linux.
Workspaces bind together JRE version, installed servers, and if you're using server connectors, all the data and temporary WARs, EARs are saved there (.metadata/plugins). Switching workspace is for switching context of your work: project, client, language, paradigm ... Workspace is the directory from where ECLIPSE bootstraps itself up. All local dependency resolutions ends up in workspace directory.
VisualStudio's "solution" concept is not even near to the concept of workspace, as solution is just parent folder to group one or more projects and give them some common CLR names and properties.
I'm using Eclipse for at least 10 years now... I got to this conclusion : I have same workspace for all projects that use same JRE and same APP server. I have different Eclipse versions, if I need some special tooling (Spring or CDI or PHP or some exotic plugin). All workspaces are located in my home directory.
You can paste / copy workspace to different computer, with same Eclipse version it works out of the box.
Simplified, a workspace is a special directory that is monitored by Eclipse: a change inside the workspace directory can trigger something.
For example, a Java file that will be saved will be compiled and might create error markers in a dependent Java projects. Changes made outside of Eclipse are visible inside Eclipse only after a refresh (assuming Window > Preferences: General > Workspace: Refresh using native hooks or pooling is disabled): instead of slow file accesses, Eclipse stores states of workspace files internally.
From a historical point of view, the workspace concept can be seen as a compromise between database and file system (in IBM VisualAge which can be seen as the predecessor of Eclipse the Java source code to be edited was stored in a database).
In addition:
Multiple instances of Eclipse can run concurrently, each with its own workspace.
Eclipse stores almost all preferences (Window > Preferences) in
the workspace (in the .metadata subfolder). Different workspaces can have different preferences.
The .metadata subfolder is also be used for caching to speed-up Eclipse.
I suspect that the target platform that is required to develop Eclipse with Eclipse (dogfooding) also played a role in the decision for the workspace concept (see also Eclipse bug 392652).
Think of a Java interface and a concrete class implementing that interface. It's similar for the Eclipse workspace and the underlying directory.
A workspace as a logical container for projects and configuration. That logical concept is implemented by a physical directory on your file system. The way it's designed, it would actually be possible (in theory) to implement a workspace using something other than a (local) file system (similar to what VisualAge for Java did, as referenced in #howlger's answer), although I don't know of any such implementation.
The point is, what you interact with while using Eclipse the IDE is a concept; it's best to not think about it too much as a filesystem directory. Doing so leads to some assumptions that won't always hold true, if you get deep enough into using it. Going back to the first sentence of this answer, you can sometimes get away with assuming a particular implementation of an interface, but doing so has hazards if you're not careful.

Package explorer of Intellij IDEA like in Eclipse

Previously I used Eclipse, but now I am using Intellij IDEA. But I can't understand one thing. In Eclipse I have SETs in which I have a group of projects. At all I have a lot of different small projects to which I have simultaneous access and I see them all in the Package Explorer. In Intellij IDEA I see only one project, and this is not convenient for me.
Does Intellij IDEA have an analogue Package Explorer? How can I see many projects in one window?
I believe you cannot open multiple unrelated projects in one window like you do in Eclipse.
You'd need to open them in multiple windows, File > Open ... and you'll choose a new window. I also wished Intellij could open multiple projects in single window. But now I get used to it. Just click CMD + ` to switch between Intellij instances on OSX.
If they're modules of your project, then you can add them from File > New > Module From Existing sources...

Where does Eclipse store projects / packages etc?

How do I tell eclipse on my desktop to open projects that are saved on my laptop without importing the project? I want to be able to save on one machine and pick up where I left off on the other. Thanks.
All projects are saved in the workspace (which saves additional meta data).
A simple solution for you would be to save the workspace on dropbox or similar and let eclipse load the work space from the drop-box folder.
Another option would be to use version control which is common in pratice (see http://en.wikipedia.org/wiki/Revision_control), e.g. git (github.com).
All of the details end up in the workspace itself. So the workspace needs to be in a location that is shared between the two machines.
Dropbox is a good option.
I would import the project into eclipse on my laptop as well as on my desktop, with the common dropbox folder as the workspace, so that everything is synced.
For instance, if I make changes to my code on my desktop, dropbox should automatically sync those changes. After that, when I open up the same code on my laptop using eclipse, I would make sure to go to my project explorer, click on the project and manually refresh (press F5). Be sure to refresh!
You can have a workspace on each machine linking to the same project files. The most convenient way is creating the project in a shared location (e.g. an external hard disk) rather than inside the workspace folder, then doing "import existing projects" on the other machine (with an independent Eclipse installation and workspace).
At this point you only need to keep in sync two Eclipse installation (same installations, removals and updates of plugins) and two workspaces (typically, you can set up one, export the configuration and import it in the other installation).
I would be uncomfortable sharing a workspace along with projects:
some settings might need to differ between workspaces. Common case: web proxy configuration.
Two workspaces can include different projects.
If you don't have exactly the same version of the same plugins, two Eclipse installations could fight to rewrite workspace settings to their liking.
Actually what you do it is stored in your workspace located in the user folder in the drive where OS is installed. You can find it simply here in your own pc
C:\Users\PCname\workspace\buky\bin
According to your scenario, I think the best option for you would be using a distributed version system. This way, you could have both projects on different machines under different local repositories (you don't even need to have a central repository or something similar), pushing changes as you work on them.
That being said, I would recommend you taking 30 minutes to read this Mercurial Tutorial.
The workspace saves this information, but it also saves a lot of other metadata that you may not want to share between different computers. Such as where dialogs are seen, what perspectives are open etc. If the Eclipse are of different versions, you may end up with the newer version converting the workspace to a later configuration and rendering it unusable to the older version.
The best way to share projects between computers is to use project sets. This will also work for sharing projects between different users. This in turn required a source repository, which is something you should always consider using.

Eclipse. Different Workspaces. Can't save same project name

all. I've read the existing threads on this topic.
My understanding is that if I use different workspaces in Eclipse, I should be able to save the same project name. But I'm not able to and not sure why.
In Windows 7, I have Eclipse Kepler (Java) installed with the C++ and Python plugins. I created three workspaces:
C:\eclipse\workspace-c++
C:\eclipse\workspace-java
C:\eclipse\workspace-python
... and I want to create HelloWorld projects in each. I can create the first project, but when I switch perspective and try to save the second in a different workspace, it says that the "project already exists."
Any ideas? Thanks for your help.
It is definitely possible to have Eclipse projects with the same name in different workspaces
Based on your description, it sounds like you may not actually be using multiple workspaces.
The following describes two ways to how start Eclipse in a specific workspace.
To start up eclipse using a specific workspace you can do the following:.
eclipse.exe -data c:\path\to\my\workspace_1
-data is used to specify the workspace on the eclipse command line
You can also switch workspaces via File->Switch Workspace
Could it be in a hidden working set? In the Project Explorer, expand the menu (downward arrow on top right) and in Select Working Set, make sure all working sets are selected.

Categories

Resources