Developers, Developers, Developers! Maksim Sorokin IT Blog

17Aug/100

UTF-8 File Encoding in Eclipse

By default Eclipse interprets files as being not UTF-8. The reason for that is that file encoding is inherited from JVM property file.encoding, which is usual set to something else. That is why you see “Text file encoding” being“ being Cp1252 (or something similar) when you right-click on a file in Eclipse.

To change it, go to Window->Preferences, Choose General->Workspace in the left menu. And change “Text file encoding” from “Default” to “UTF-8”.

23Mar/100

Eclipse “Favorites” and JUnit 4 Static Imports Revised

After some time of using static imports workaround for JUnit 4 and EasyMock described earlier I came to the conclusion, that editing import "favorites" is not a good idea.

The problem is that when you include a class with static methods in Eclipse "favorites", then in Content Assistant you see hundred of those static methods. This maybe somewhat inconvenient. Moreover, Content Assistant hangs a bit longer before appearing.

From now on I am directly using class name like Assert.assert.. or EasyMock.expect.. instead of using static imports.

19Feb/100

Development With GlassFish v3

GlassFish is becoming new de facto standard in Java applications. Development with new GlassFish v3 server and Eclipse now is really fast and comfortable. Server starts within a second, Java EE 6 is fully supported and hot code replacement works as it should.

12Feb/100

Eclipse and JUnit 4 Static Imports

Importing static JUnit 4 annotations in Eclipse is somewhat boring. The thing is that by default Eclipse doesn't import static fields or methods.

The most optimal way is to add junit.framework.Assert to "favorite" static types. Then, assertion methods will be seen in editor.
How to:

  • Menu -> Window -> Preferences
  • Java -> Editor -> Content Assist -> Favorites
  • New Type: junit.framework.Assert

P.S.: idea taken from http://blog.xebia.com/2008/10/12/eclipse-tip-keep-static-imports-for-junit-4/