Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read on various sites about licenses.

I did just put the license type in the header file (in my case a javascript file, open-source):

 * "codeName" "version"
 * Copyright 2012 "codeName"
 * Released under the "LICENSE NAME" license

 javascript code

In the same folder I leave a copy of the license. The listing of the folder looks like this:

* codeName.js

In the file LICENSE is the full text of the license my code uses.

What I cannot find anywhere that says is this is enough to say my code is licensed (the case of open-source). Is something more required?

share|improve this question
up vote 5 down vote accepted

Major open source licenses like the Apache or GPL have instructions on exactly how to put a comment at the top of each one of your source files. If you follow those instructions, you should be good. And yes, generally that means choosing a license, and adding a header as you showed at the top of every one of your source files. Please try to pick a license you will want to keep (understand the difference between Apache and GPL) and license all the files for your project under the same license.

The other thing you might want is a contributor's agreement. Contributors sign it to state that they are not adding any copyrighted, patented, or trademarked contributions to your code, or that if anything is copyrightable, patentable, or trademarkable, it falls under the license for the project. Consider a clause that states your intent in licensing and allows you to change the license to another one with the same intent at any time, or if the current license is proven difficult to enforce in court.

That said, I generally don't see licenses in HTML, CSS, or JavaScript files that get sent to the client. I think it's reasonable if you want to consider an abbreviated version for those files to speed up download times.

I am not a lawyer. These are just observations and suggestions, not legal advice.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.