I'm developing a commercial application that largely depends on the functionality of a library that will be developed with it. I'd like to open-source this library, because it offers functionality that is not found elsewhere and can be useful in other applications.However, I will also use it in my own commercial application. I don't want to publish the source of the main application, but it is definitely not a derived work (think of calculator app using GPL licensed library to calculate sine). And if someone else commercially uses the library, I want to require them to publish any changes made.Is the GPL license suitable for this or is LGPL perhaps what I need?
License for library developed with commercial program
java;licensing;commercial
Since you are the author, you can give yourself the library under different terms from what you give the library to others (and you can give it under different terms to various others). As long as you are the only author or get all contributors agree to the special terms for you (you'd need good lawyer to write the agreement so that it's valid across the world though), you can give the library out under any terms you want.This is what Trolltech has been doing for long years with Qt. It was GPL or commercial, so GPL applications like KDE could use it free, but if you wanted to write commercial application, you had to pay for it.So if you want to get some advantage of the library, you can use that model too. Otherwise  you have to use LGPL; A calculator using GPL library to calculate sine definitely and unambiguously is a derived work of the library and must be shipped under GPL.Also don't forget that LGPL only excludes dynamically linked objects. If you don't like that, either use Mozilla Public License or GPL with library use exception like libgcc has, or one of the yet more permissive ones, i.e. MIT/X, new BSD or (as mentioned in comments) Apache License or Eclipse Public License (the later two are lately popular because they cover patent grants).Derived work note: Everything that links to a GPL library has to be covered by it. Even things that don't directly depend on it. E.g. if you have GPL library g and another library h and link them both to application i, you have to provide source not just for application i, but also for library h that does not depend on g! That's because the linked binary is a derived work of the library g (for the binary it's obvious) and GPL requires that if you give that derived work to somebody, you have to give everything it contains under GPL except vaguely defined system libraries. So it includes library h that itself knows nothing about g!MPL note: Looking at Mozilla Public License I am not really sure what it covers. I think it does not cover larger software that includes the derived work, but I am not sure.