Eclipse IDE 3.7 Book available for the Kindle

Today I released my new Eclipse IDE 3.7 book for the Kindle device.

Eclipse IDE 3.7
Fundamentals of Java Programming, Debugging, JUnit Testing and Mylyn Tasks with Eclipse

This book demonstrates how you can develop Java applications, how you can debug them and how to write JUnit tests for your applications. It also explains how you can work with local Mylyn tasks to organize your work efficiently.

It also includes important Eclipse configuration tips which make programming with Eclipse more effective.

After finishing this book you should feel comfortable with using the Eclipse IDE for standard Java development tasks and you should be equipped to explore Eclipse further.

You find the book in all Amazon stores:

Eclipse IDE 3.7 in Amazon USA
Eclipse IDE 3.7in Amazon Germany
Eclipse IDE 3.7 in Amazon UK
Eclipse IDE 3.7 in Amazon France
Eclipse IDE 3.7 in Amazon IT
Eclipse IDE 3.7 in Amazon ES

This book summerizes several tutorials I publish on my website. It includes the Eclipse IDE introduction tutorial, the JUnit tutorial, Debugging with Eclipse, my Mylyn Tutorial and my favorite Eclipse shortcuts. The full content of the book is still available online on my website.

I would especially thank Elias Volanakis for his thorough spell checking and feedback on the content.

I also am very grateful to Wayne Beaton for writing the foreword and providing feedback on the content.

In addition I would like to thank the Eclipse Foundation and Ian Skerrett for the permission to use the Eclipse logo and Matthew Nuzum for the permission to use his svg version of the Eclipse logo.

I got many suggestions or corrections from countless readers of my website and I would like to express my deepest gratitude for their contributions.

I have plans to add an EGit chapter over the next months. If you buy this book now you will get the update with EGit for free. I have confirmed twice with the Amazon customer support that if I publish an update to this book that buyers of the book will get notified and that they can download the updated book with EGit for free.

I’m again surprised how much work it is to convert my website content into a book format. I hope you like this book and if you new to Eclipse I hope you enjoy your learning experience.

Posted in Eclipse, vogella | Tagged , , , , | 10 Comments

Automatically starting Services in Android after booting

To start Services automatically after the Android system starts you can register a BroadcastReceiver to the Android android.intent.action.BOOT_COMPLETED system event.

In the onReceive() method the corresponding BroadcastReceiver would then start the service.

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class MyReceiver extends BroadcastReceiver {

	public void onReceive(Context context, Intent intent) {
		Intent service = new Intent(context, WordService.class);

If you application is installed on the SD card, then it is not available after the android.intent.action.BOOT_COMPLETED event. Register yourself in this case for the android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE event.

Also note that as of Android 3.0 the user needs to have started the application at least once before your application can receive android.intent.action.BOOT_COMPLETED events.

You find more on Services in my Android Service and BroadcastReceiver Tutorial.

I hope this helps. You find me also on Twitter. My Google+ profile can be found Lars Vogels Profile.

Posted in Android | Tagged , , | 3 Comments

How to remove the //TODO comments from auto-generated code

Eclipse Code Templates are great. Unfortunately they add lots of comments for stuff I don’t like:

public class MainTest {

     * @param args
    public static void main(String[] args) {
        // TODO Auto-generated method stub



If you also don’t like the TODO comments you can change the templates via: Window -> Preferences -> Java -> Code Style -> Code Templates.

In the code tree you have the templates. Select for example Code → Method Body and press “Edit” to edit this template and to remove the todo comment.

I hope this helps. I also added this to my Eclipse IDE tutorial in the Eclipse templates section.

You find me also on Twitter. My Google+ profile can be found Lars Vogels Profile.

Posted in Eclipse | 2 Comments goes Creative Commons CC BY-NC-SA 3.0 licence

Recently I received lots of requests for translating my tutorials into other languages or if my tutorials can be used in Universitity classes. In general I’m fine with that as long as the usage is non-commercial and attribution is given.

I decided to select a official licence for usage of my content so that others have better information on how they can use it. As far as I can tell the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany (CC BY-NC-SA 3.0) looks like the right licence to me.

Therefore, unless otherwise stated in the tutorials, I put the tutorials on under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany (CC BY-NC-SA 3.0) licence.

Attribution for a translation or reproduction which is available on the web would be a link to the original article as well as mentioning me as the original author. This attribution should be clearly visible at the beginning of the article.

If you use the material in a non-web form an attribution should be given in the same spirit. For example if you print the material for your university class you would include a page which states the original author as well as the link to the content on the web.

Neil Barlett suggested to clarify the non-commercial part. My understanding is that this means that you cannot earn money by replicating or translating the content, e.g. via advertisements, selling books, etc.

Also a big thanks to Jovan Kostovski and Kai Toedter at Google+ for lots of consulting and tips on the licence.

I hope this help other to translate my tutorials and to spread the word about Eclipse, Android and other Java related programming around the non perfectly english speaking world.

Posted in Android, Eclipse, vogella | 2 Comments

December Challenge of the month and retroperspective – The eye of the storm

Last month challenge was a big success. I published my first ebook: Distributed Version Control with Git. I also have several other articles which I’m in the process of converting them also to ebooks.

I really enjoyed the process and learned a lot about epub, mobipocket, DocBook, XSLT and Apache Ant. Is also helped me a lot with October Challenge of the month as I invested significantly time and effort into improving the content and the spelling. Also I finally learned how to use InkScape with was July Challenge of the month.

This month challenge will be to wrap up things. Things are a bit crazy at the moment and I’m incredible busy. This has unfortunately lead to several loose ends which I need to tie up. So nothing new this month but I have to finish lots and lots of little things.

Posted in Challenge of the month | Comments Off on December Challenge of the month and retroperspective – The eye of the storm

Plurals in Android

Android supports Plurals. Plurals are XML based resources which allow to handle different quantities. This way you can select the right text based on the quantity. In your XML file you specify values for the quantities “zero”, “one”, “two”, “many”, “few”, “many”, “other” and in your code you use the method getQuantityString() to get the correct value. You can also format strings. If now Strings are formated then you pass in the plural resources and the number. If Objects should be used for formating you pass them as additional parameters.

For example the following will define a plural. This file needs to be in the “res/values” directory and in this example it is called “plurals”.

<?xml version="1.0" encoding="utf-8"?>
        <item quantity="zero">no Tutorial </item>
        <item quantity="one">one Tutorial </item>
        <item quantity="other">%d  Tutorials</item>

The correct value can then be select via the following coding:

// number is defined somewhere before this
// number =....
// Get the Resources
Resources res = getResources();
// Get the 
String quantityString = res.getQuantityString(R.plurals.tutorials,
	number, number);
// Do something with it...

From the Android development guide: Note that the selection is made based on grammatical necessity. A string for zero in English will be ignored even if the quantity is 0, because 0 isn’t grammatically different from 2, or any other number except 1 (“no tutorial”, “one tutorial”, “two tutorials”, and so on).

Thanks to mohammad dabbour and Kirill Grouchnikov for clarifying a question on this in Google+.

I hope this blog entry helps. You find me also on Twitter. My Google+ profile can be found Lars Vogels Profile.

Posted in Android | 4 Comments

Eclipse //TODO in generated coding – Is this useful?

I just returned from Devoxx, a really nice conference. I had a lot of fun and learned a lot.

I also had the oppertunity to talk one influential developer, who shall remain unnamed.

He told me why he prefers IntelliJ over Eclipse. Very interesting and I will open Bugreports for most of his points in the future.

One thing he mentioned was that the //TODOS in the generated code are annoying. I personally agree. I have configured my Eclipse code templates to have no comments included.

Which makes me wonder, does anyone likes these //TODO comments in the generated code? If the majority thinks they are not useful I think we should open a bug report to JDT and ask them to change the templates.

Please let me know via comments what you think.

Posted in Eclipse | 25 Comments

Distributed Version Control with Git available for the Kindle

Today I released my first book for the Kindle platform: Distributed Version Control with Git.

Git is popular, especially in my main focus areas, Eclipse and Android.

Since a while I’m working in converting my tutorials into offline versions. The Git tutorial is the first one because it has no images. To my surprise it was still a huge amount of work. I hope the second book will be easier, as I learned a lot about epub, mobipocket, design, DocBook, XSLT transformations, Apache Ant, Inkscape and other tools.

You find the Git Book in all Amazon Stores:

Git Book in Amazon Germany
Git Book in Amazon UK
Git Book in Amazon France
Git Book in Amazon USA

Just to set the right expectations, the Distributed Version Control with Git has the same content related material as the online version. I hope that having this material also available for the Kindle is helpful. Is also allows you to read the online version before deciding if you want to get the book offline.

A big thanks goes to Alex Blewitt for writing the foreword and for providing feedback. I would especially thank Jennifer Nerlich de Vogel for their intensive spell checking exercises. Wolfgang Schell who is a power Kindle user gave important feedback for improving the structure of the book to optimize it for the Kindle.

I also got many suggestions or corrections from my readers and other people involved with Git and would I would like to express my deepest gratitude to their contribution including Robert Konigsberg, Elke Schaper, Appaholics, Michael Wiedmann, Joshy Cyriac, Peter Kahle, Jon Svede, Henning Hoefer, Matthias Sohn, Chris Aniszczyk, Stefan Lay, Edwin Kempin, Sasa Zivkov, David Carver.

Also a big thank you to Ralf Ebert who seeded the idea to publish on the Kindle platform.

Now I’m hoping for positve reviews at Amazon. 🙂

Posted in Android, Eclipse, vogella | Comments Off on Distributed Version Control with Git available for the Kindle

Eclipse – Setting the default perspective via config.ini

A quick tip for the Eclipse IDE (and also useful for Eclipse RCP). You can use the “config.ini” (in your Eclipse installation folder) to define a perspective.

For example the following in config.ini will set the default perspective to the resource perspective.


Make sure to add this before the JVM options.

For find the perspective ID you can use the Plugin menu spy.

You find all possible startup parameters listed The Eclipse runtime options

Hope this helps.

Posted in Eclipse | 1 Comment

Challenge of the month and retroperspective – Getting offline

This challenge of this month will be a publish something for the Kindle on I played with the thought and the technology to convert tutorials from into E-books for a while now and I think I should give it a try. I hope that by having my tutorials available offline for the Kindle that this will help people in getting their work done. I also believe that this might result in a better quality in my tutorials as they now available to a wider audience.

Last month challenge was a good preparation for this. I actually did a lot of spelling and error corrections for my site. Several people did also proof-read my stuff and gave valuable input. I’m aware that this need to continue but I think I had a good start.

Posted in Challenge of the month | 3 Comments