Organization with licensing using Eclipse

Coding is a fun experience; You learn something every time! But, sometimes, you may want to share things like source code, and resources, etc! For this you will need licensing. If you are new to licensing, I highly suggest that you check out codinghorror’s take on it (if you haven’t picked a license, I would suggest GPLv2.0, for its protection for you, and easy use for others). With licensing, you usually have to put a license at the beginning of every single file. Take this file for example. That bunch of lines will take up a lot of space in your file! Luckily, if you are using eclipse, you have a feature for just that!

Start by going to Window -> Preferences. You will want to search for ‘Code Templates.’ Click on the search result, and click on ‘Code’ in the middle section. Now press edit, and a window should pop up.

The window that pops up is the code that is done for you when you make a class. Ever notice how in eclipse, you don’t have to type out the package declaration, since its already there? That is because of this window. Now that you can edit it, you can add in a javadoc comment with all sorts of goodies like who made it, when was it made, in what package, in what project, what license (important), etc. With the license, I would suggest not putting the license in, but the link to the license.

Not only will this small little tip save you some time, but it will also save space to not have the full license, but the link to it. Also, in discovery of that menu, you can now edit all of the things you want that will automatically appear on creation, whether it be javadoc for every method, or some extras for getters and settters.

I hope you have benifited! Criticism is much appreciated (especially if I screwed up with my law education)!

-wes

Yay! Now I don’t have to use my special license-header script!

TBH, I should have just done this in the first place, but the license-header script was more fun.

Good tutorial. Thanks for sharing. Maybe it’s more nice if it had larger screenshots.

I disable all the template stuff and use libgdx’s FileProcessor, eg: