Fork us on GitHub

How To Use The Codename One Sources

Debug, Modify, Contribute & Learn thru our open source project
Post Image

How To Use The Codename One Sources

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:

  1. Signup for Github
  2. Fork http://github.com/codenameone/CodenameOne and
    http://github.com/codenameone/codenameone-skins
    (also star and watch the projects for good measure).
  3. 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.
  4. Download the cn1-binaries project from github here.
  5. 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.
  6. 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.

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

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.