This question already has answers here:
How to create an Intellij and Eclipse compatible code style and code formatting configuration (for java code)?
(3 answers)
Closed 4 years ago.
I am working on a java project with a team. All of the members use eclipse and I use intellij. Everytime I push my code to github there are hundreds of diff lines unnecessarily due to formatting differences in eclipse and github.
Also hashcode and equals method generate different code style in intellij wrt eclipse.
How can I configure intellij to use same code formatting and code generation style used by eclipse?
My teammates use default settings of eclipse.
In eclipse, you can export the code formatter settings to XML.
Intellij allows you to import these settings. That works for most parts. But even on the intellij help pages you find information that some things won't work (but there is an intellij plugin supposed to help, too). See their blog for example.
For code generation, things are a bit different. But I think that intellij even asks you what "style" to use when generating these methods.
The other part that really requires attention: order of import statements. But that one is easily, as that link implies, you edit your IntelliJ settings once, and they match. For the formatter, theoretically, every time when eclipse releases a new release, you might have to export/import settings again. This is a never ending story ...
Leading to: be aware that fighting tooling is always an uphill battle. In our setup, enough people switched from eclipse to intellij to make it work. I wouldn't have made that step otherwise. And I researched such questions first, instead of first learning a new tool, ending up in large, annoying diffs.
Related
Few weeks ago I tried Intellij and I found it really awesome. Now, at my project there are two programmers (including me) using Intellij and few other programmers who are going to keep using Eclipse. Since this project is already very large and it's going to grow a lot, we need to use compatible Code Style and Code Formatting between Intellij and Eclipse. We do not want to have problems when one user edits some file and reformats it before saving. With Eclipse "alone" we used to have some exported configuration, and before anybody starts to work, the first step is just to import this configuration. We already tried to use External Code Formatter, but it didn't work on Intellij 9.
So, I have a bunch of questions here:
Is there any way to import eclipse formatting configuration on Intellij 9?
Anybody could share their experience managing this kind of situation? Do you guys have any other suggestion to manage this situation?
There is an updated plugin for IDEA, called Eclipse Code Formatter:
http://plugins.intellij.net/plugin/?idea&id=6546
I would recommend someone spends the time to configure their IntelliJ's code style to be the same as Eclipse. This will take a little time and effort but once it is done, you can export it just like in eclipse so that any other IDEA users can import it.
You could also search online to see if anyone has already done this and you can simply download the code style config and use it.
The only alternative I can think of would be to find a standardized code style template that is available for both eclipse and IntelliJ, like the Recommended Sun Java Code Style.
There seems to be a plugin for that (emerged from this discussion).
This question already has answers here:
Things possible in IntelliJ that aren't possible in Eclipse?
(41 answers)
Closed 8 years ago.
I have been working with Eclipse for quite some time and recently got several recommendations to use IntelliJ.
As I just saw that questions of the format of "Which IDE is better?" are frowned upon (not without a good reason) - I wanted to know objectively what are the advantages of IntelliJ over Eclipse.
I know what Eclipse does and frankly I'm not missing anything. But this is exactly what I said about Visual Studio 2005 (C#) before starting to work on Eclipse - and now I can't even write a Hello World in VS without getting annoyed ...
I'll narrow the question down to the world of Java SE and Java EE only. No Android, no GUI.
I'm looking for:
What does IntelliJ give me that Eclipse lacks?
What does Eclipse give me that IntelliJ lacks?
Try to be objective, and please only answer if you had substantial experience with both tools.
Thanks.
Edit: The scope of work I'm looking for is both for working on private projects and as part of a team of several developers working on the same product. But if I have to choose - I'll focus on teams only.
JUnit is a crucial part of the work (personally I started working in TDD several months ago - but lets not open that).
I'll also be interested to know about ANT/Maven related benefits if there are - although my prime motives are to know if I can benefit from things like: Quicker development (e.g. code generation, templates, auto complete etc.), Easier AUT, simpler Java EE application deployment during development (for UT) etc.
For me there are two points:
Refactorings (IntelliJ is great in the refactorings it provides)
Plugin stability, I've always found that when I have a stable install of Eclipse, I get a new plugin and everything comes down in flames and I have to reinstall everything.
IntelliJ allows me to navigate between Java, JSP, JS, CSS and pretty
must every other type of file. With Eclipse I need to install a plugin
to be able to navigate through file types other than Java.
#Rachel. Hmmm. In Eclipse Ctrl-Shift-R (on mac Command-Shift-R), open up "Open Resource" dialog where you can type whatever you want and it will match ANY file, not just Java. Ctrl-Shift-T will do the same, but limit it only to Java types.
This is the keymap of IntelliJIDEA.
Just read this article and you able to doing amazyng features with IntelliJ which you do not even dream of in Eclipse. For me, the most useful are Ctrl-Y , Ctrl-Enter, Ctrl-Alt-T, Shift-F6 and auto-completion.
Code navigation. (being able to find method and field declarations and usages.)
We have a J2EE project at work where both IntelliJ and Eclipse are in use so I have been able to compare the abilities of both.
IntelliJ allows me to navigate between Java, JSP, JS, CSS and pretty must every other type of file. With Eclipse I need to install a plugin to be able to navigate through file types other than Java.
This question already has answers here:
Stand-alone Java code formatter/beautifier/pretty printer? [closed]
(9 answers)
Closed 7 years ago.
My team is developing Java code in a couple different IDEs, with differing numbers of columns. It's worked well so far, but we've been asked to deliver compilable code to a partner with the source limited to 80 columns. We'd like to do this as a professional courtesy, but we're not able/willing to work with 80-column limited code on a day to day basis. Are there any tools available that will take Java code, and intelligently add line breaks so that it fits within 80 characters and still compiles correctly? Ideally, I'd like it to be one more automated step in our build process, to go recursively through our source directory for .java files and produce a copy with the new formatting.
I'm not interested in the virtues of 80-column code or editors that do or don't word wrap, just in seeing whether there is a quick fix that will make everyone happy without anyone having to change the way they do things.
Intellij and eclipse and almost any IDE will do that. But...
Maybe you want to ask yourself if you want to automate that, even if you do that in an automated way, let's say maven, the code could be break up in a way it's harder to read than it was before, it can be breaking in the middle of an important line or method and you don't want that even if it compiles.
What we have done in the past is set a couple of .xml file with the settings of eclipse or intellij (they both allow you to export the settings), then with maven use the checkstyle plugin to enforce developers to have this settings; it will allow you to do it in a day by day basis always with a developer deciding when the code should break the line.
And lastly, maybe you want to use 100 or 120, they are the new 80.
It's not as automated as you like, but in Eclipse you could define an 80-column profile (Preferences -> Java -> Code Style -> Formatter), then in the Package Explorer, right-click on your root package, and choose Source->Format.
I would suggest using code formater in Eclipse to get the 80 columns issue taken care of.
Then to make sure you're not missing anything - take a look at checkstyle to see that you're adhering to those standards
Any modern IDE will auto-reformat according to your preferred style, but I would only do this on code that's seriously unformatted, else it can wind up looking less readable. In particular if the original author did a lot of custom formatting for clarity, the result will lose it.
And I second the suggestion to move to 100-120 characters. The 80 character limit was suitable for CRT terminals (24 lines x 80 columns), and for the 1928 IBM punch card standard.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Can anyone recommend a light Java IDE that doesn't require you to make new projects each time you want to compile and run a program? I just want to be able to open java files and compile and run them. I have already tried Eclipse and NetBeans but both require you to make a new project each time you want to compile and run a program. Making a new project is fine for large scale projects but for small school assignments this just makes the process more tedious.
I've been doing java school assignments using Eclipse. I had one project called "Homework", and created a new package for each assignment. That worked fine for me.
Update: in addition to the practice suggested above, it seems eclipse has a subproject (still in incubation, though) called ide4edu that is specifically for educational purposes.
The Eclipse IDE for Education is a version of Eclipse streamlined specifically for use by university and college students.
In Eclipse, you can just paste code into the package explorer without a given project, and a new project is created containing a file with that code, inside a main method. If the text you paste is a full class, it will name the file according to the class name. You could also set up a single project for your stuff and paste the code or the files you want to run into that project.
I've used Notepad++ to do this for simple Java projects and it worked quite well. Here is a guide on how to do this.
You may also want to check out jEdit, I believe it offers similar functionality, and may be more feature-rich for Java than Notepad++ is.
My school uses DrJava for the first intro to programming class. Its a lightweight IDE and allows you to create folders on the fly for your java classes.
However, my classes now require Eclipse or Netbeans, and it did take some getting used to them. In some places, Eclipse is overkill for a second-year CS student, but I do like its features & am having fun exploring the extensability with other languages.
It might sound geeky or "not for novices" but in order to compile and run a single file the best option(in my opinion) is a console environment.And of course you can view them from notepad++ or any editor with similar fetures(especially highlighting).
How about using a editor like Vim, or Emacs and then install some plugins so that you can have basic IDE features like code completion, etc? You will need to do bit of monkeying to get the right kind of combination and comfort. But, it could well be your answer for a lightweight IDE, one that does not require you to create a project.
NetBeans can have an arbitrary number of classes with main() methods. Create a project named school using NetBeans and create a new package for each group of related assignments. Customize the default configuration menu to make F6 run your current main(). At the same time, develop your skill with bash and a favorite command line editor.
Some universities (like mine) use
BlueJ
for Java Teaching. It basically got everything you need for your homework assignments, and it got NO code completion, which I find perfect for Java beginners ^^.
What's wrong with creating project? Just create it ones and then use it for all your assignments. That will let you use any good IDE (NetBeans, Eclipse, Intellij Idea, ...) which, from other side, greately simplifies writing java code.
I recommend bash. I write a lot of test programs for work (and for the likes of answering stackoverflow questions). javac MyMain.java && java MyMain and you are done.
I have done one project and many unrelated packages, but that sucks. It also cannot cope with more complicated build cases (when dealing with, for instance, serialisation or class loaders).
Personally I enjoy using Emacs for editing my code than then Ant to build / compile my Java code.
Bare in mind that using a lightweight editor will generally mean loosing out on some very useful features, for example:
Auto completion. So for example in Eclipse if you start typing System.out. you can a list of options to complete the statement along with which parameters the function will require
Mistake highlighting : nice "red swiggly lines" highlighting simple mistakes
Build path management : adding external archives is trivial in eclipse less so from the command line for those with little experience
Amongst many others.
Personally I'd way up whether the "faff" of setting up a new project for a simple Java application is worth loosing those really useful features. And that usually varies per task.
I recommend jGRASP. It's a (very) lightweight Java editor, good for the beginning programmer. You can literally paste in some code, compile and save, and your program is ready to be run.
You need a well defined classpath before you can just compile you classes, and that's exactly what the project setup is for.
Just create a project once and forget about it - use it for all your stuff.
you can use cedit. which is not exactly a IDE but you can have compiler and JVM tools attatched to it and you can do whatever you have mentioned. i mean creating a small java file compile and run.
you can that here http://mac.softpedia.com/get/Word-Processing/CEdit.shtml
Why don't you create one project and fill it with all the programs you ever write. There is nothing forcing you to create a new project each time. The only reason to have multiple projects is to make managing the programs easier. So if projects don't make your life easier don't create multiple projects.
BTW: I suggest IntelliJ as I believe it is better, but in this case I suggest the problem is how you work and changing IDE won't make much difference.
This sounds redundant, but the posters are right. However, you know what you can run. If you don't have the resources and you need to run a webserver, putty, etc.. notepad ++ would work (light enough). If your desktop is nice and can handle it, use Eclipse (vast adoption). Create a java project and add packages to it (as Kaleb, Frank and other suggested).
To use IDE for assignment, my approach is to create a test project and use it each time for different assignments. Because in IDE like Netbeans and Eclipse, each class file can be made executable, thus it is quite convenient acutally.
Also for assignments if you want to have more control over your code, Notepad++ is very good for writing codes. You can add in features such as Compile and Run using macros in Notepad and make shortcut key for it.
VIM and Emacs can also be good choices as my friend often talk with me about them. Well i am not quite familiar, you can try it.
I love vim, but not having things like IntelliSense/Code completion from Eclipse makes it pretty difficult. I know, I know, I should be able to look at method signatures and java docs for the API I am interested in using. I'd love to, but I'd like it to be accessible from my fingertips instead of having to browse the source tree manually or have a JDK reference handy.
What plugins would make this easier?
I tried eclim for a while. It was pretty good, basically it uses eclipse in the background as a kind of engine and provides a plugin to let you use all of eclipses goodness through vim.
http://eclim.org/
Don't write Java in Vim — put Vim inside a Java IDE:
IdeaVIM for IntelliJ
viPlugin or Eclim for Eclipse
jVi or ViEx for NetBeans
I love Vim, but using an IDE for Java is the only way to stay sane. A decent Java IDE will:
Show invalid syntax or type errors
Show missing JavaDoc
Manage import statements for you
Highlight unused methods and variables
Safely perform powerful refactorings such as moving methods or renaming classes -- (no, search and replace doesn't cut it, I promise)
Reformat your code automatically or on-demand
Vim can't do the above, but you can use all the Vim keybindings in a program which does.
I use Eclipse + Vrapper. Enables the vi dual mode editing we all know and love. <ESC>
Completely free and lightweight. The goal is to have the comfort and ease which comes with the different modes, complex commands and count/operator/motion combinations which are the key features behind editing with Vim, while preserving the powerful features of the different Eclipse text editors, like code generation and refactoring.
While eclim is another alternative, I feel eclim takes over Eclipse and vrapper doesn't.
Check out the JDE plugin for Vim. It provides Java omni-completion and a documentation viewer (among other things).
I use the javacomplete.vim plugin for omni-completion for java. It's a very nice script: it also shows the method signatures on top of the omni-completion. The downside is that it is a bit slow, but it has worked fine for me otherwise. Eclim might be better ut I haven't tried it yet so I can't comment on it.
I've also used the jcommenter.vim plugin for generating javadoc comments. It can parse method signatures and automatically add the relevant #param foo fields and such.
For the API searching I would suggest on overriding the K key on normal mode. It searches man pages for the keyword under the cursor, but the behavior can be overriden by setting the keywordprg variable. See this thread for an example.
Other scripts which I've found very useful (not specific to Java development): NERDCommenter, AutoClose, snipMate, Align.
There's an IntelliJ VIM plugin as well. Plus, IntelliJ is released an open-source, free version.
Vim is not an IDE replacement. But very specific additional tool. With Vim you should only do small-fast tweaks while the main development is going under Netbeans/Eclipse/IDEA.
One more time. It is a Bad Bad Bad idea to turn Vim into Full IDE. Why? It won't be so fast. And thus won't be so pretty.
Here is scenario. You have opened Eclipse or whatever to edit your current task. And in 10 minutes you have to switch to another Task which is kind of urgent. The task is to tweak a little a maven or an ant built script and/or some deployment perl/python/groovy scripts.
How much time will it take to reload Eclipse to work on a new 5 minutes task and switch back?
But if you are Vim guru you can handle this in seconds. You can change one file and run Ant/Mvn within Vim.
And this is the power of Vim. You can change and check one file in no time no matter which extension it has: java, groovy, c++, makefile, bash, c#, etc.
This will be an uphill battle. There is so much knowledge about your program built into Eclipse, that I expect you will eventually have to reimplement it all to be happy.
Any particular reason you cannot just decide you like the built-in editor in Eclipse?