Category Archives: Eclipse

Stop HTML and XHTML line wrapping

I’m always using the eclipse formatter but formatting XHTML or HTML files simply destroys readability with default settings. To get rid of this simply change the line width to 999 in Web -> HTML Files -> Editor -> Line width. You can also turn it of for XML under XML > XML Files > Editor > Line width

Eclipse Luna Performance

To speedup eclipse I first edited the eclipse.ini file to look like this (don’t just copy paste my file – compare it with yours):

-vm
/opt/jdk1.8/jre/lib/amd64/server/libjvm.so
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms60m
-Xmx1024m
-Xss2m
-Xverify:none
-Duser.name=mbo

I removed lines setting MaxPermSize as this is deprecated in Java 8. What I added:

  • Using vm argument to have eclipse running as “eclipse” and not “java”. I think this also brings a performance boost.
  • Changed requiredJavaVersion to 1.7 as 1.6 is dead.
  • Added more memory to Xms and Xmx.
  • Added Xss to configure stack memory.
  • Added verify:none to disable java class verification. Here some explanation I found what this does (till today I had no problems with this):
    Disables Java class verification. This can provide a 10-15%
    improvement in startup time at the expense of being unable to
    detect corrupt or invalid class data. If corrupt class data is
    loaded the JVM may behave unpredictably or crash.
    
  • Configured the author name to override logged in username.

Method must have signature “String method(), String method(),…

Under Eclipse Luna (4.4) M6 my JSF project gave exceptions like the following when I had EL snipplets like

<h:commandButton action="#{userController.delete(u)}" ...

And here the error in eclipse:

Method must have signature "String method(), String method(), String method(String), String method(String, String), String method(String, String, String), String method(String, String, String, String), String method(String, String, String, String, String), String method(String, String, String, String, String, String), String method(String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String)" but has signature "String method(UserFm)"

I could not figure out what should be wrong with my code and it works well and there were no complaints in older eclipse versions. So I decided to switch off the responsible validation  under Window > Preferences > Web > JavaServer Faces Tools > Validation > Type Assignment Problems > Method expression signature incompatibility.

Remove Eclipse Search Field / Quick Search

I never used the quick search field and there is no possibility to remove it from within eclipse as the request to be able to disable it seems to have very low priority in the dev team.

I’m watching the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=362420 from the very beginning and now someone posted the hint to remove it via css.

Open the file eclipse/plugins/org.eclipse.platform_<version>/css/e4_basestyle.css and add the following at the end of the file:

#SearchField {
   visibility:hidden;
}

After that you have to restart eclipse. After that the quick search should be gone.

m2e Java heap space

I got the following error during eclipse startup:

eclipse.buildId=M20130204-1200
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

Error
Tue Jun 04 16:59:24 CEST 2013
An internal error occurred during: "Updating indexes".

java.lang.OutOfMemoryError: Java heap space
	at org.apache.maven.index.updater.IndexDataReader.readUTF(IndexDataReader.java:144)
	at org.apache.maven.index.updater.IndexDataReader.readField(IndexDataReader.java:134)
	at org.apache.maven.index.updater.IndexDataReader.readDocument(IndexDataReader.java:108)
	at org.apache.maven.index.updater.IndexDataReader.readIndex(IndexDataReader.java:75)
	at org.apache.maven.index.updater.DefaultIndexUpdater.unpackIndexData(DefaultIndexUpdater.java:523)
	at org.apache.maven.index.updater.DefaultIndexUpdater.loadIndexDirectory(DefaultIndexUpdater.java:212)
	at org.apache.maven.index.updater.DefaultIndexUpdater.access$300(DefaultIndexUpdater.java:75)
	at org.apache.maven.index.updater.DefaultIndexUpdater$LuceneIndexAdaptor.setIndexFile(DefaultIndexUpdater.java:645)
	at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:829)
	at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:156)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateRemoteIndex(NexusIndexManager.java:1136)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateIndex(NexusIndexManager.java:1080)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager$1.run(NexusIndexManager.java:657)
	at org.eclipse.m2e.core.internal.index.nexus.IndexUpdaterJob.run(IndexUpdaterJob.java:72)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

To solve this just delete the .cache folder in your M2_REPO directory (default ~/.m2/repository/.cache)

Eclipse: JBoss very slow in Debug mode

I had the problem that starting my jboss application server was veeeeery slow – don’t know how long it would have taken as I always killed it after a few minutes. After some experiments with more memory without a change I removed all my breakpoints in the debug view of eclipse and voilá – it works again.

So just delete all your breakpoints under window => show view => other… => breakpoints.

Set Author Name in eclipse.ini

Eclipse uses the system username by default. This is not always useful. Especially if you can’t choose the username on your own. To get around this just add “-Duser.name=Max Mustmann” (without quotes!) in your eclipse.ini somewhere after vmargs.

JBoss AS 7.1 Eclipse Startup Warning

Since 7.1 the following warning appears during server startup:

WARNING: -logmodule is deprecated. Please use the system property ‘java.util.logging.manager’ or the ‘java.util.logging.LogManager’ service loader.

This can be fixed be removing the following part from the launch configuration in the “Program arguments” section:

-logmodule org.jboss.logmanager