How To Use The Codename One Sources

UPDATE August 10, 2018 - The steps described in this article are out of date. The Codename One project now includes an ANT script that will retrieve dependencies and build the project automatically. See the Quick Start section of the README for instructions.

I've written open source software since the 90's both for my own projects and for Sun Microsystems. When we founded Codename One open source was the only option!

We didn't choose open source with the goal of receiving code contributions. Contributions are pretty rare even in highly visible projects. We saw the true benefits of open source for a project like Codename One: trust.

When you choose a platform for your code you need to trust that it will be there tomorrow & open source alleviates some of this risk. Open source keeps us honest about our cloud pricing.

E.g. if we overcharge or provide shoddy service a fork might gain traction. This is a benefit to the consumer that helps us in forming trust and gaining traction in the long run.

I felt the need to write this opening paragraph due to a highly visible source code closing done by another company. We have no intentions, plans, thoughts or wavers in that direction. Furthermore, we consider contributions to be the least important benefits of Open Source Software.

Codename One is "more" open source than most projects, e.g. OpenJDK is OSS but its pretty hard to change code within it. Its even hard to contribute these changes!

You can use/change most of our code using a trivial process. You don't need a complex compiler toolchain for changing or debugging Codename One. Most importantly: 99% of the code is in Java so you should feel right at home!

Using The Source

We already have an old tutorial called "use the source" but its pretty old by now. It still points at the old SVN and didn't really go into details, so re-doing that and reminding you that this can be done seems in order.

When you debug your app with our source code you can place breakpoints deep within Codename One and gain unique insight. E.g. a Form flickers in your application just place a breakpoint in Display.setCurrent() .

When you run into a bug or a missing feature you can push that feature/fix back to us using a pull request. Github makes that process trivial and in this new video and slides below we show you how.

The steps to use the code are:

Signup for Github Fork http://github.com/codenameone/CodenameOne and

http://github.com/codenameone/codenameone-skins

(also star and watch the projects for good measure). Clone the git URL's from the projects into the IDE using the Team->Git->Clone menu option. Notice that you must deselect projects in the IDE for the menu to appear. Download the cn1-binaries project from github here. Unzip the cn1-binaries project and make sure the directory has the name cn1-binaries. Verify that cn1-binaries, CodenameOne and codenameone-skins are within the same parent directory. In your own project remove the jars both in the build & run libraries section. Replace the build libraries with the CodenameOne/CodenameOne project. Replace the runtime libraries with the CodenameOne/Ports/JavaSEPort project.

Update August 10, 2018 - You will need to build the codenameone-skins project using the build.xml file in its root directory in order to generate some skins that are required to build the JavaSE project.

This allows you to run the existing Codename One project with our source code and debug into Codename One. You can now also commit, push and send a pull request with the changes.

Video - How To Use The Codename One Sources

Slides