Go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button (or Edit and then Export in dialog that opens up). Then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.

As of IntelliJ IDEA 13, there is no possibility to import .settings/.prefs files directly.


Edit: IntelliJ can import the following Eclipse properties:

  • General
    • Right margin, Formatter on/off tags
    • Indentation
    • Indent size
    • Usage of ‘Tab’ character
    • Usage of Tab only for leading indentation (Smart Tabs)
    • Indent ‘case’ branches from ‘switch’
    • Indent class members
    • Keep comment at first column
  • Spaces (Java)
    • Before/after comma (as set for Eclipse method declaration parameters)
    • After comma in type arguments
    • Within array initializer braces
    • Within brackets (in array reference)
    • Within parentheses of: annotation, ‘for’, ‘if’, ‘catch’ ’while’, ’switch’, method, empty method, parenthesized expression, method call, type cast, ‘synchronized’
    • Before parentheses of: ‘try’, ‘for’, ’while’, ‘switch’, method, ’if’, ‘catch’, method, method call, ‘synchronized’.
    • After type cast
    • Around unary, assignment operators (if it’s set for ‘before’ and ‘after’ in Eclipse).
    • Before opening brace of: array initializer, ‘switch’
    • Before ‘?’ in conditional expression
    • Space before/after ‘:’ in conditional expression
    • Space around binary operators (a single Eclipse setting is mapped to multiple IntelliJ IDEA’s settings)
  • Blank lines
    • Around fields and methods
    • Before/after package
    • Before/after imports
    • Before method body
    • Keep blank lines in code (number of empty lines to preserve)
  • Wrapping
    • New line before: closing brace in array initializer, ‘else’ in ‘if’ statement, ‘finally’ and ‘catch’ in ‘try’ statement, binary operator (if wrapped)
    • New line after: opening brace in array initializer Special ‘else if’ treatment (compact ‘else if’)
    • Keep simple blocks in one line
    • Keep control statements in one line
    • Alignment of: array initializer expressions, arguments in method declarations and calls, field declarations, extends list, assignments, binary expressions, ‘throws’ clause, resources in ‘try’.
    • Brace style for: code blocks, methods and classes
  • JavaDoc
    • Enable JavaDoc formatting
    • Blank lines in JavaDoc
Answer from user1438038 on Stack Overflow
🌐
JetBrains
blog.jetbrains.com › home › intellij idea › intellij idea 13: importing code formatter settings from eclipse
IntelliJ IDEA 13: Importing Code Formatter Settings from Eclipse - The JetBrains Blog
January 31, 2014 - All you need is to export settings ... the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import....
Top answer
1 of 3
30

Go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button (or Edit and then Export in dialog that opens up). Then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.

As of IntelliJ IDEA 13, there is no possibility to import .settings/.prefs files directly.


Edit: IntelliJ can import the following Eclipse properties:

  • General
    • Right margin, Formatter on/off tags
    • Indentation
    • Indent size
    • Usage of ‘Tab’ character
    • Usage of Tab only for leading indentation (Smart Tabs)
    • Indent ‘case’ branches from ‘switch’
    • Indent class members
    • Keep comment at first column
  • Spaces (Java)
    • Before/after comma (as set for Eclipse method declaration parameters)
    • After comma in type arguments
    • Within array initializer braces
    • Within brackets (in array reference)
    • Within parentheses of: annotation, ‘for’, ‘if’, ‘catch’ ’while’, ’switch’, method, empty method, parenthesized expression, method call, type cast, ‘synchronized’
    • Before parentheses of: ‘try’, ‘for’, ’while’, ‘switch’, method, ’if’, ‘catch’, method, method call, ‘synchronized’.
    • After type cast
    • Around unary, assignment operators (if it’s set for ‘before’ and ‘after’ in Eclipse).
    • Before opening brace of: array initializer, ‘switch’
    • Before ‘?’ in conditional expression
    • Space before/after ‘:’ in conditional expression
    • Space around binary operators (a single Eclipse setting is mapped to multiple IntelliJ IDEA’s settings)
  • Blank lines
    • Around fields and methods
    • Before/after package
    • Before/after imports
    • Before method body
    • Keep blank lines in code (number of empty lines to preserve)
  • Wrapping
    • New line before: closing brace in array initializer, ‘else’ in ‘if’ statement, ‘finally’ and ‘catch’ in ‘try’ statement, binary operator (if wrapped)
    • New line after: opening brace in array initializer Special ‘else if’ treatment (compact ‘else if’)
    • Keep simple blocks in one line
    • Keep control statements in one line
    • Alignment of: array initializer expressions, arguments in method declarations and calls, field declarations, extends list, assignments, binary expressions, ‘throws’ clause, resources in ‘try’.
    • Brace style for: code blocks, methods and classes
  • JavaDoc
    • Enable JavaDoc formatting
    • Blank lines in JavaDoc
2 of 3
13

In the latest (2020) IntelliJ IDEA, if you have the "Eclipse interoperability" plugin installed, it's as simple as:

Settings > Editor > Code Style > Java > ⚙️ > Import Scheme > Eclipse XML Profile

Discussions

Formatting Code
Changing the formatting of code in Eclipse to match the formatting used in IntelliJ IDEA can be done by configuring the code style settings in Eclipse to match those of IntelliJ IDEA. Here are the general steps to achieve this: **Install a Formatter Plugin (Optional):** - There are some Eclipse plugins available that can help you format your code according to IntelliJ IDEA's style. One such plugin is the "Eclipse Code Formatter" plugin, which can be found in the Eclipse Marketplace. **Configure Eclipse Code Formatter:** - If you've installed the Eclipse Code Formatter plugin or a similar tool, configure it to use the IntelliJ IDEA code style. - In Eclipse, go to `Window` > `Preferences`. - Expand `Java` > `Code Style` in the left-hand menu. - Click on `Formatter`. - You can create a new profile or edit an existing one. - In the Formatter Profile window, you can define your formatting preferences to match IntelliJ IDEA's style. This may include settings like indentation, brace placement, and more. **Import IntelliJ IDEA Code Style Settings:** - If you have access to IntelliJ IDEA, you can export its code style settings and import them into Eclipse. - In IntelliJ IDEA, go to `File` > `Settings` (or `IntelliJ IDEA` > `Preferences` on macOS). - In the settings dialog, navigate to `Editor` > `Code Style`. - Select your desired code style (e.g., Java) and customize it if needed. - Click the "Export" button to save the code style settings to an XML file. **Import IntelliJ IDEA Code Style into Eclipse:** - Back in Eclipse, under `Window` > `Preferences`, expand `Java` > `Code Style`. - Click on `Formatter`. - In the Formatter Profile window, click the "Import" button. - Browse to the XML file you exported from IntelliJ IDEA and import it. **Apply the IntelliJ IDEA Code Style:** - After importing the settings, you can apply the IntelliJ IDEA code style to your Java files. - Select the Java file(s) you want to format or use it globally for all files. - Right-click on the selected file(s) or folder and choose `Source` > `Format`. **Save the Preferences:** - To make sure your settings are saved, click "Apply" and then "OK" in the Preferences dialog. Keep in mind that Eclipse and IntelliJ IDEA may have some differences in their code formatting options, so achieving an exact match may not always be possible. You may need to make some manual adjustments or compromises to get as close as possible to your desired code style. Additionally, you may need to install additional plugins or extensions in Eclipse to fully match the IntelliJ IDEA experience, as some features may not be available out of the box. More on reddit.com
🌐 r/eclipse
1
0
September 5, 2023
java - Importing code style formatting settings into eclipse from intellij-idea - Stack Overflow
The problem I am finding is that ... and importing them into eclipse. and I cannot manually configure eclipse to conform with the nuances of the new style guide (Continuation indentation being the main problem). Any help or Ideas would be fantastic. :) ... I couldn't find a ready plugin for that in 2018. So here is a side by side code style configuration from UI perspective of Intellij IDEA 2017.3 and Eclipse OXYGEN.3 March 2018. If both configured this way the code will be formatted close enough, ... More on stackoverflow.com
🌐 stackoverflow.com
java - Import IntelliJ formatter options into eclipse? - Stack Overflow
I'm the only one using eclipse in an all-IntelliJ team. Is there any way I can have eclipse format the code with the same style as the default IntelliJ formatter does, without having to manually ad... More on stackoverflow.com
🌐 stackoverflow.com
intellij idea - Import eclipse settings to intellijI - Stack Overflow
In eclipse go to the Preferences >> Java >> Code Style >> Formatter and export it via "Export All" option. As a result, you will get a XML file. In IntelliJ, go to File >> Other Settings >> Default Settings >> Code Style >> Java >> go to "Manage" >> go to "Import" and select that exported XML file. More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › krasa › EclipseCodeFormatter
GitHub - krasa/EclipseCodeFormatter: IntelliJ plugin - use Eclipse's code formatter directly from IntelliJ. https://plugins.jetbrains.com/plugin/6546 · GitHub
Eclipse uses 99 by default · For versions lower than 4.0 - make sure to disable IntelliJ's Import Optimizing in the reformat dialog via Settings | Editor | Show "Reformat Code" dialog. The plugin will take care of imports anyway · For versions higher than 4.0 - imports will be reordered together with normal IntelliJ's import optimizing ... The file is actually formatted ...
Starred by 514 users
Forked by 117 users
Languages: Java 93.9% | HTML 5.8% | JavaScript 0.3%
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 207778589-Import-eclipse-formatter
Import eclipse formatter – IDEs Support (IntelliJ Platform) | JetBrains
August 30, 2016 - For example the "Wrapping and Braces ... be able to import this since the ones we have are already in eclipse, I have seen this post: https://blog.jetbrains.com/idea/2014/01/intellij-idea-13-importing-code-formatter-settings-from-eclipse/...
🌐
JetBrains
plugins.jetbrains.com › plugin › 6546-adapter-for-eclipse-code-formatter
Adapter for Eclipse Code Formatter - IntelliJ IDEs Plugin | Marketplace
Allows using Eclipse's Java code formatter directly from IntelliJ. Solves the problem of maintaining a common code style in team environments where both IDEA and...
🌐
Reddit
reddit.com › r/eclipse › formatting code
r/eclipse on Reddit: Formatting Code
September 5, 2023 -

How to change the formatting of Eclipse IDE code to match the IntelliJ IDE format?

For example, the formatting of Streams in Eclipse bothers me, and I'd like to make it the same as IntelliJ's.

My laptop is too weak to download IntelliJ.

Top answer
1 of 1
3
Changing the formatting of code in Eclipse to match the formatting used in IntelliJ IDEA can be done by configuring the code style settings in Eclipse to match those of IntelliJ IDEA. Here are the general steps to achieve this: **Install a Formatter Plugin (Optional):** - There are some Eclipse plugins available that can help you format your code according to IntelliJ IDEA's style. One such plugin is the "Eclipse Code Formatter" plugin, which can be found in the Eclipse Marketplace. **Configure Eclipse Code Formatter:** - If you've installed the Eclipse Code Formatter plugin or a similar tool, configure it to use the IntelliJ IDEA code style. - In Eclipse, go to `Window` > `Preferences`. - Expand `Java` > `Code Style` in the left-hand menu. - Click on `Formatter`. - You can create a new profile or edit an existing one. - In the Formatter Profile window, you can define your formatting preferences to match IntelliJ IDEA's style. This may include settings like indentation, brace placement, and more. **Import IntelliJ IDEA Code Style Settings:** - If you have access to IntelliJ IDEA, you can export its code style settings and import them into Eclipse. - In IntelliJ IDEA, go to `File` > `Settings` (or `IntelliJ IDEA` > `Preferences` on macOS). - In the settings dialog, navigate to `Editor` > `Code Style`. - Select your desired code style (e.g., Java) and customize it if needed. - Click the "Export" button to save the code style settings to an XML file. **Import IntelliJ IDEA Code Style into Eclipse:** - Back in Eclipse, under `Window` > `Preferences`, expand `Java` > `Code Style`. - Click on `Formatter`. - In the Formatter Profile window, click the "Import" button. - Browse to the XML file you exported from IntelliJ IDEA and import it. **Apply the IntelliJ IDEA Code Style:** - After importing the settings, you can apply the IntelliJ IDEA code style to your Java files. - Select the Java file(s) you want to format or use it globally for all files. - Right-click on the selected file(s) or folder and choose `Source` > `Format`. **Save the Preferences:** - To make sure your settings are saved, click "Apply" and then "OK" in the Preferences dialog. Keep in mind that Eclipse and IntelliJ IDEA may have some differences in their code formatting options, so achieving an exact match may not always be possible. You may need to make some manual adjustments or compromises to get as close as possible to your desired code style. Additionally, you may need to install additional plugins or extensions in Eclipse to fully match the IntelliJ IDEA experience, as some features may not be available out of the box.
🌐
GitHub
github.com › WasiqB › java-formatter
GitHub - WasiqB/java-formatter: My common Eclipse IDE Code cleanup and formatter for Eclipse and IntelliJ · GitHub
To trigger code formatting, navigate to menu Source > Format. For importing these setting files in IntelliJ, you need to first install Eclipse Code Formatter plugin from Preferences > Plugins.
Author: WasiqB
Find elsewhere
🌐
Atlassian
openmrs.atlassian.net › wiki › spaces › docs › pages › 25469543 › Developer+How-To+Setup+And+Use+IntelliJ
Developer How-To Setup And Use IntelliJ - Documentation - OpenMRS Wiki
If you update the documentation please update the IntelliJ version as well! 1. Install Eclipse Code Formatter plugin in intelliJ | Go to Files -> Settings -> Plugins | Select Marketplace and search for Eclipse Code Formatter, then install it and restart your IntelliJ.
🌐
DEV Community
dev.to › bassemibrahim › have-anyone-managed-to-format-code-in-intellij-just-like-eclipse-102g
Have anyone managed to format code in IntelliJ just like Eclipse? - DEV Community
April 17, 2019 - I tried to export Eclipse formatting options and import it into IntelliJ. That for some bizarre reason didn't work. they must have different sets of options. I tried to use an IntelliJ plugin called Eclipse Formatter but it throws an error. It's not even formatting the code for me
🌐
ImageJ
imagej.net › develop › intellij
Developing ImageJ2 in IntelliJ IDEA
Open IntelliJ · Open your project · Open File › Settings › Eclipse Code Formatter · Check the Use the Eclipse code formatter radio button · Set Eclipse Java Formatter config file to the XML file you just created · Set Java formatter ...
🌐
JetBrains
youtrack.jetbrains.com › issue › IDEA-104068 › Import-of-Eclipse-code-formatter-code-templates-and-organize-imports
Import of Eclipse code formatter, code templates and ...
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions.
🌐
ImageJ
imagej.net › imagej-wiki-static › Eclipse_code_style_profiles_and_IntelliJ
Eclipse code style profiles and IntelliJ - ImageJ
October 13, 2017 - Open IntelliJ · Open your project · Open File > Settings > Eclipse Code Formatter · Check the Use the Eclipse code formatter radio button · Set Eclipse Java Formatter config file to the XML file you just created · Set Java formatter profile to ImageJ · Check Optimize Imports ·
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 206575559-How-to-Export-Code-Formatting-Configurations-to-Eclipse
How to Export Code Formatting Configurations to Eclipse – IDEs Support (IntelliJ Platform) | JetBrains
March 27, 2016 - I'm confused why we need the third party plug-in when IntelliJ can import. ... Importing Eclipse code style will convert supported options to IDEA formatter. Using the third-party Eclipse formatter plug-in invokes the same formatting engine as used in Eclipse which can support more options and provides exactly the same results as in Eclipse.
🌐
Eclipse Foundation
eclipse.dev › jkube › contributing
Contributing to Eclipse JKube
Next navigate to Java -> Code Style -> Organize Imports. Click Import and select the eclipse.importorder file in the ide-config directory. Open the Preferences window (or Settings depending on your edition), navigate to Plugins and install the Eclipse Code Formatter Plugin from the Marketplace.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 206920395-Is-there-a-way-to-import-Eclipse-code-formatting-settings-in-to-IntelliJ-
Is there a way to import Eclipse code formatting settings in to IntelliJ? – IDEs Support (IntelliJ Platform) | JetBrains
Our team uses Eclipse almost exclusively but the use of IntelliJ is also allowed, as long as the code formatting rules are followed exactly as in Eclipse.Is there a way to import the Eclipse code f...
🌐
Programmersought
programmersought.com › article › 8530742171
Intellij Idea Synchronize Eclipse Code Formatting - Programmer Sought
This option determines how the code is formatted. Simultaneously configuring the From file of the Import order is also the code-style.xml file for Eclipse. This option determines how the import area is organized. Use Intellij's formatting shortcut "Ctrl+ALT+L" to format.