• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem with using several IDEs on the same machine

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, now I am having a headache - I did my school projects in Eclipse, then I decided to try NetBeans and Idea - now all my projects are marked as Idea, and I can run them in neither IDE. How do you guys prevent this from happening when using different IDEs on the same machine? I recon there is no way to convert Eclipse built projects to NetBeans or Idea, correct? Please, share with me how to fix the situation and to prevent it in the future - I really hate loosing 2 semester work to this stupid issue. Thank you.
 
Sheriff
Posts: 13570
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Eclipse mainly and sometimes switch to IntelliJ IDEA. I never mix the two together just so I can avoid the problem you describe. Here's what I do (Caveat: there may be other better incantations but this approach isn't too onerous for me -- I'd welcome an opportunity to make it better though if anyone has a better way):

1. Most Important Thing: Use a version control system. The first thing I taught my son when he enrolled in a computer programming course was how to use git for version control. I think instructors are doing their students a disservice if this is not one of the first things they teach. It's not that hard if you give them some basic commands to follow. Get an account on GitHub and go through their online help. There are also some free books available online, like Pro Git. Don't be afraid of the "Pro" in the title.

2. Exclude any Eclipse or IDEA project files by adding them to your .gitignore file. Google will turn up info on how to do this. Exclude .class files, too. You will mainly only want to keep your Java source files (*.java) in git.

3. Both IDEs usually support git out of the box. If not, install the git plugin. Each IDE will have its own way of installing plugins. Eclipse has its Marketplace. You will look for the eGit plugin or something similar. Again Google for how to do that.

4. Have a work area for Eclipse and a separate one for IDEA.

5. Eclipse and IDEA both have ways to import projects from a version control system, like from git. When working in Eclipse, import the project from git into your Eclipse work area. When working in IDEA, import your project into your IDEA workarea.

6. Commit your changes to git.

7. When you switch to the other IDE, just update your workarea from git. That should synch you up with the latest changes that you have committed from the other IDE.


This recipe develops some important habits that all programmers should have:

1. Use a version control system

2. Keep work compartmentalized

3. Always commit your work to version control

4. Always update your local workspace from version control to make sure your local files are in synch with your version control system.
 
Junilu Lacar
Sheriff
Posts: 13570
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[rant]

One of the annoying things I read in my son's course materials (this was a college-level Introduction to Programming in Java course) was the section about making backups of their work. Making backups of your work is good advice. The annoying part was that the main example for making backups was copying files to a flash drive or external drive. That's a pretty ridiculous thing to teach future programmers. Teachers should give their kids more credit. Like I said, I taught my son how to use git right away. I helped him set up a local git repository. I told him to create an account on GitHub, which he did. I showed him how to use git init, git clone, git add, git status, git commit, git reset, git update, and git push. He was off and running with git in less than 30 minutes. I think he's only one of a few in his class who uses git or some kind of version control system. I think that is pretty appalling.

[/rant]
 
Junilu Lacar
Sheriff
Posts: 13570
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Lena Sergeenko wrote:Please, share with me how to fix the situation and to prevent it in the future - I really hate loosing 2 semester work to this stupid issue. Thank you.


All your *.java files should still be there. I would create a new directory, then copy all your *.java files there, preserving whatever directory structure you already have in the original. IDE-specific project files are usually kept separate from your Java source files so it should be fairly easy to extract just the *.java files to a new directory.

Then follow my previous advice about using a version control system like git.
 
Junilu Lacar
Sheriff
Posts: 13570
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's some information regarding IDEA and version control:

http://stackoverflow.com/questions/11968531/what-to-gitignore-from-the-idea-folder
https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems

You can find information specific to Eclipse by searching for gitignore for Eclipse Project Files

Other searches you might find useful:

using Git
using GitHub
ignoring files in git

importing projects from git into IDEA
importing projects from git into Eclipse
 
Lena Sergeenko
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Junilu! I am familiar with github and used it for my website project once - but how do I run git from Eclipse? I use EE and do not see any mentioning of it in Preferences or elsewhere. I probably need to download EGit - but which one? For Mars, or Mylyn connector or both? Do I need p2 repository (what the heck that is?) if I do not have a team? There is also some Jgit - you see, I have a technical problem now. ))) Can you help me with this, too? Huge thank you for your help!!!

Never mind, I found Git in Perspectives. )))))
 
Junilu Lacar
Sheriff
Posts: 13570
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Lena Sergeenko wrote:how do I run git from Eclipse?


I taught my son to run git from the command line. It's not that hard and it's always good to be comfortable working on the command line. I find working with git this way to be much faster than clicking around with the mouse. I'm actually trying to get used to working in tmux so I can start freeing myself from having to use the mouse for many of the things I have to do while programming.
 
Lena Sergeenko
Greenhorn
Posts: 18
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK I'll try. Oh, and tell your son he is lucky to have such a great mentor right at home - I wish I had somebody like you by my side. )))) Have you thought about doing tutorials? Like video How-To's? I think you would be great.
Anyway, thanks for your help.
 
Bartender
Posts: 20939
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may be interested in knowing that for a while I had several dual-IDE projects. They offered developers the choice of IntelliJ or Eclipse. That was possible because both IDEs allowed free-form project structure (older IDEs notoriously forced you to put specific resources in specific places. So you could have Eclipse .project and .classpath files plus Intellij's equivalent (XML) files. IntelliJ also kept a third file with developer-specific project state in it and that file was excluded from version control to avoid people from polluting each other's workspaces. Eclipse has a separate workspace directory and while all projects within the workspace have resources defined within the workspace (including metadata), the actual project files could be kept in a directory that was external to the workspace, thus allowing both Eclipse and IntelliJ to share the same code directory.

Of course, I don't recommend running both IDE's simultaneously on such a project, since their concepts of file edit history and class compilation wouldn't be kept in sync, but switching back and forth was no problem.
 
Lena Sergeenko
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Marshal
Posts: 65113
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult for “beginning”. Moving discussion.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!