score:-1
The following link may be of assistance http://netbeans.dzone.com/articles/importexport-code-formatting it talks about sharing sharing settings.
score:0
It should be easy to use Eclipse's formatter as a plugin in Netbeas, like it was done for IntelliJ
score:1
It would appear that, as of Netbeans 7.3.1, a very clever fellow developed a Netbeans plugin that accepts Eclipse Formatter XML files. I have not tested this yet TBH, but I will be doing so in the very near future (as I am the only one at the office that prefers Netbeans over Eclipse, and I think my co-workers are conspiring to kill me due to git merge conflicts).
https://blogs.oracle.com/geertjan/entry/eclipse_formatter_for_netbeans_ide
score:2
I like NetBeans very much, but have the same problem with formatting. I've found this maven plugin http://mvneclipsefmt.sourceforge.net/usage.html Seems it can run eclipse formatter as maven goal. But I didn't try it yet.
score:2
There is a post on JBoss community which seems to address formating issues, it might be of some help; http://community.jboss.org/wiki/ImportFormattingRules
score:2
You can use "Eclipse Code Formatter for Java" NetBeans plugin it works with NetBeans 7.3 and .7.4 (but with a little problem!).
score:5
AFAIK There is no way to import the Eclipse formatting preferences into NetBeans. But if you use Maven you can use the Maven2 Java Formatter Plugin which uses the Eclipse JDT features to format source files and integrates nicely with Maven projects. For a usage of current version 0.3.1 see here.
This is a simple pom.xml using the formatter. Just put in any Java source file and run mvn java-formatter:format
, your source should be formatted using the given Eclipse configuration file (where you have to provide the path to your own one).
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mackaz</groupId>
<artifactId>maven.java.formatter.plugin.example</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
<configuration>
<configFile>./example-eclipse-code-format-config.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
EDIT:
A different approach is to invoke the Eclipse Code Formatter from commandline, (but takes a bit longer and is not nicely integrated into the Maven lifecycle), as described here. You can format a sourcefile with it like this:
/opt/eclipse/eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -nosplash -config example-eclipse-code-format-config.xml src/main/java/de/mackaz/FormatMe.java
(Also take a look at this page where the author put that into a little script)
It should be easy to integrate one of those approaches into NetBeans. Either wrap those inside an Ant file and add that to your NetBeans commands, or write a little NetBeans plugin to add the action e.g. to the contextmenu (which is pretty easy, especially compared to writing Eclipse Plugins).
score:6
The answer is YES. You can use eclipse code formatter in Netbeans, and enjoy using Netbeans. You need to download eclipse code formatter plugin from below location suitable to your Netbeans version, import your existing eclipse code formatter and ready to go
http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java
Source: stackoverflow.com
Related Query
- Can I use or import an Eclipse formatter in NetBeans?
- How can I import NetBeans project to Eclipse and vise versa?
- How can I use an Eclipse formatter profile in VIm?
- Can I use a different Eclipse Formatter Profile for on-open and on-save?
- How can I use Eclipse to import an existing project?
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- How can I import javax.json in eclipse
- Can Eclipse the Organize Import (ctrl+shift+o) command's handling of static imports be modified?
- How can I get Eclipse 2018.09 to use the JUnit 4 test runner by default?
- What is the difference between Eclipse and Netbeans if I want to use only the Java in it?
- How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
- Can the Eclipse Java formatter be used stand-alone
- Can Eclipse import a Maven Web project as a "Dynamic Web Application"?
- Can Eclipse use the same sdk that Android Studio (intelliJ)?
- Where can I find the setting for folding / unfolding the import statements in java in eclipse by default
- Need to import Eclipse Java Formatter profile in Visual Studio Code
- How can I run a Maven webapp in Eclipse when I use profiles to populate properties files at build time?
- How do I get Eclipse to use NetBeans key bindings?
- Can Eclipse Formatter Wrap Where Necessary, Every Element on a New Line?
- How to import Eclipse syntax highlighting profile in Netbeans for Java projects?
- How can I use eclipse to build a GUI? (I want to use only swing/awt and no other packages)
- How can I use Eclipse to debug tests driven by sbt?
- How to import android studio project in eclipse which use library?
- Can the Eclipse formatter be configured to indent multiple lines between parenthesis properly?
- How can I use WindowBuilder core in Eclipse Kepler to make a simple window?
- Eclipse no longer can auto import java Classes
- How can I use Firebase cloud message in an eclipse project?
- why I cannot use "run Android lint" from menu "Window" in Eclipse in toolbar I can run it, is it OK?
- How can use mingw-w64 and MSYS2 with any IDE like eclipse or codeblocks?
- How to use eclipse with ssh, so that the remote projects can be edited by local eclipse?
More Query from same tag
- java.io.IOException: bt socket closed, read return: -1
- Cannot resolve class in same package, async android development using eclipse
- Eclipse - Show @SuppressWarnings(value={"all"}) when lombok's Data and Constructor added
- File in the classpath not being published (Eclipse + JBoss AS)
- Adding options to eclipse from plugin
- BIRT report modification
- @BeforeAll not working in SOME files in Eclipse
- Eclipse complains about "jakarta.servlet.http.HttpServlet" was not found
- Eclipse - how to get the line which caused an exception?
- Determine version of Eclipse from crash dump
- Can't start Eclipse
- How to join 2 APKs into 1 APK?
- Change highlight color for fields in Eclipse
- Google Play Services Admob Migration - InjectView.value must be a constant
- how to determine the time when you end a sentence during registration?
- Multiple JFrame instances
- Compiling C++/GTK within Eclipse
- Red5 server failing to start up due to java.rmi.server.ExportException: internal error: ObjID already in use
- Eclipse plugin tutorials
- Facelets tab lib not recognised by Eclipse/Tomcat 6
- upload jar file to svn
- Eclipse content assist (JavaCompletionProposalComputer) not triggered
- Eclipse Android Phonegap App Emluator only displays "Hello World" instead of own index.html
- Mac - TFS - Eclipse Error : unable to instantiate class "com.microsoft.tfs.client.common.ui.views.TeamExplorerView
- telepat Java Eclipse IDE plugin
- Eclipse IDE debugging with code change
- App can't be opened because it is from an unidentified developer
- Java:Selenium Grid: How to Run specific tests on particular node
- How to validate SWT form?
- creating new triple using sparql query