Sun Wireless Toolkit and general Java questions

15 réponses [Dernière contribution]
Jayn
Hors ligne
A rejoint: 08/27/2010

As someone who had been superstitious about Java "being bad", I was shocked to read on the FSF's website some time ago about Java being released under the GPL in 2007. http://www.fsf.org/working-together/gang/java
With that encouragement, I went on to find out that MANY mobile phones have a built in interpreter for Java Micro Edition (ME) and many of those phones are very inexpensive to buy in prepaid or un-locked versions. I myself got a Motorola em326g for all of 4.99 USD new which includes a microSD slot and a JavaME interpreter for "MIDlets" as the Java apps are called. I am even working with a schoolteacher I know to develop a JavaME program that runs on exactly that model phone to help teach Math to special-needs students. Since most of the phones firmware just sits there and is never modified or upgraded, I think the firmware OS of the phone can be regarded as a circuit (correct me if I am wrong) and therefore practically hardware. The important thing is that there are many MIDlet apps that are released as Free Software and I only use and install those that are. Many such projects are on Sourceforge, others can be found in the "back alleys" or with search engines.
The problem for me came when I began to learn to write the programs. Since I run Trisquel, I checked which Java IDE's qualify as Free, and went from there. Eclipse is my DE of choice as Netbeans did not show up, although some pieces of it did... I had to fetch a plugin for Eclipse Called EclipseME for Micro Edition Java development, which is under the Eclipse Public License, which is what I think the Eclipse program in general is under and that made into Trisquel so I assume the EPL is an OK Free Software License.
Now getting to the real dissapointment- the Sun Wireless Toolkit (WTK). In many tutorials, this is said to be needed to make MIDlets work on a Java phone, yet it must be downloaded from Oracle under a restrictive "Oracle Technology Network Developer License" which I have read and do not like very much at all! The license can be found on the following page: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javame-419430.html#sun_java_wireless_toolkit-2.5.2_01b-oth-JPR

At first, I read the third party license agreement which had some jpeg stuff,
Apache 1.1 and 2.0 licenses, and the SGI license for Opengl and thought that was the license for the WTK, but it turns out not to be.

So my question is: Should I stop developing MIDlet apps for my nice little phone because doing so requires non-free software? Obviously the program code can be licensed under GPL as many MIDlets on Sourceforge are, but to compile them correctly, I believe (maybe I am wrong) one needs the Sun WTK. Perhaps one may be able to get away with using just ant on a build.xml file? I will have to try it. I think there is a reason to continue because there is a wealth of Free Software MIDlets for JavaME, and it has helped me learn alot about coding already, I cannot really see giving up. It has also helped me be content with simple functionality like reading ascii txt books/articles, playing public domain MIDI, and imagining the possibilities of such a limited device. I bought 2 spare BD50 batteries, and on all 3 have run over 3 weeks without ever nearing a wall outlet. I think there is really something to this platform, and like RMS all those years ago I don't want to give up. Maybe there is a Free version of the WTK? Or maybe it is not REALLY needed, just convenient?

I do not understand how Java itself can be GPL and yet nasty licenses like these still muck things up for developers of Free Software. I turn to you hackers because I know Freedom matters to us and I myself am not capable of coding a replacement for the Sun WTK overnight. Thank you for your dedication and patience.

miga
Hors ligne
A rejoint: 09/17/2011

To answer on a few of your questions:
1. The 'firmware' you're talking about is probably the operating system. This /cannot/ be regarded as a circuit, as it's what controls things. The phone's running a proprietary system.

If you want to do any sort of Java development with freedom in mind (on both your development environment and the phone itself), I would probably say that you should pick up a device like the HTC G1 or any other device supported by the Replicant Project. This is a fork of Google's Android operating system that aims to be 100% free software, eliminating proprietary bits in the operating system.

Of course, you would have to get a whole different phone in order to do that.

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

The smartphone's operating systems can (and are) updated. They are not circuits. The FSFE even leads a campaign called Liberate Your Device.

That said, free software is good. Even if it runs on proprietary operating systems. For instance, Emacs runs on Windows too. As for developing, Stallman himself had to use UNIX to replace it. Just make sure that you application runs on a free operating system (or as free as possible: check out the previous link). Otherwise, your application would potentially hinder the users to switch to freedom.

Jayn
Hors ligne
A rejoint: 08/27/2010

Magic Banana,

To clarify, the phones I purchase are NEVER connected to any service or activated and airplane/flight mode is turned on so as to make them pocket computers. There would be no remote updating as in an always-connected android device and there is no wifi at all. I am thinking way older and lower-tech than that. My target is older phones that support Java CLDC and MIDP, so about 2002 onwards. My idea is to re-purpose them so that they are no longer phones and put them in the hands of curious child and adult hackers with only Free MIDlets. In my opinion, this far exceeds the interest and goodness of any one of the current hand-held gaming units. Users can copy, share, modify, etc. all the programs, provided they have that darned Wireless Toolkit (which is quite old) to compile with. That right there is the hang-up. I am not worried about remote updates because the companies no longer care about a 3+ year old budget prepaid phone. On some of the more expensive phones, such as Motorola ROKR, there is aftermarket firmware to replace the factory one, but it is not for every phone and I actually think that it is not 100% Free anyways.

I am not sure if a JavaME applet could run unmodified on a Free Desktop, but maybe it could be tested on Replicant if that system can run JavaME programs. Otherwise, since they have the source, the users could adapt it to run on JavaSE with OpenJDK. Since it is a playful on-the-side thing, I am not looking to sway people to do anything except start running Free JavaME apps on their old outdated phones. It's not as if by making a killer-app for J2ME I could convince users to abandon GNU/Linux and start illogically using Apple products. Whenever possible in the "about pages" I always advocate for using 100% Free Software, so rather than hinder users switching to Freedom, I would rather hope I might actually lure them into it by showing them how it can breathe new life into "outdated" phones they may have otherwise thrown away.

Jayn
Hors ligne
A rejoint: 08/27/2010

Yes, and these students (and I) can afford to set up a class with 5 dollar phones, not 100 dollar G1. I have heard about and like Replicant, but all the supported devices are prohibitively expensive to me at the time.

With regard to the firmware, maybe I should revise my view of it as a circuit. It is more similar to a proprietary BIOS, and plenty of Free Systems boot Free Software distros while still having that BIOS. And yes, I know CoreBoot exists, but it does not support every motherboard and not every device even has a BIOS these days. This may be too lax a view for many here, but I would rather install a Free distro on top of a proprietary BIOS (which also controls the system for a time) than to just trash the whole machine.

miga
Hors ligne
A rejoint: 09/17/2011

But in this case, it's a proprietary BIOS running on a proprietary OS that's running free applications.

I didn't know that cost was an issue, so that throws the G1 idea out.

I don't know, maybe it's possible that you could get a free operating system running on the devices you want. That would require delving deeper to gain freedom. Whether you or somebody else would be up for it would be the true question.

Jayn
Hors ligne
A rejoint: 08/27/2010

I think the BIOS IS the OS for the low-end phones. There it not something else that the "BIOS" loads as a more advanced OS. It is like operating within the 'BIOS' like on that old Windows CE platform. There is a project called Jlime for Windows CE handhelds that uses a bootloader to take control of the hardware and boot from files stored on a Compact Flash card. I am guessing it would not be trivial to make something like that for any given phone model, especially those without external memory card slots. Then there is the issue of getting an OS into, say 1MB. So it would be a herculean effort even for someone actually skilled enough. I at this point would rather subvert what is already here. I am not saying the path of less effort is always preferred, but to spend years on something that is not super essential and can in essence be done now seems wasteful to me when there are higher priority projects.

Chris

I am a member!

Hors ligne
A rejoint: 04/23/2011

The only time that I'd consider acceptable to write software for a non-free platform would be if it was to assist users off that platform. Short of this you are attracting users to a non-free platform. That's not good.

Regardless of what you do try and avoid letting the free/non-free issue get in the way of moving away or helping others move away from non-free software.

Jayn
Hors ligne
A rejoint: 08/27/2010

I do not know what everyone thinks of services like Tracfone, Net10, etc., but I myself do not use major cellphone contract services but instead opt for Tracfone. Many Tracfones have the JavaME capability and I already use the devices as phones, so I see it as as only a plus that I can load some GPL code onto that phone to, say , learn vocabulary or even play a game. Trying to change the ROM, even if it worked (for most it does not) would make my phone service disappear. It is unrealistic to expect one company or few companies (the ones that accidentally make the phones that can run Free distributions that retain phone radio operability) to be able to furnish EVERYONE with hardware, and more people with affordable hardware has been an undeniable driving force in the Free Software adoption process. Therefore most of us are left with the question of how to best approach the issue. Even the FSFE instructs people to IMPROVE their android situation, and FREE their devices, not to trash them! Honestly not all devices have prospects for being Replicant ready soon or maybe ever. They are right, it does take a lot of work to do it from scratch and given the small team, it is likely they will not get to phone XYZ in time for people to still want to use it. Which is why I think the most should be made of the devices right now. It is great that laptops are capable of wiping the hard drive and starting again easily, but not so much for many portable devices. I see these not as potential e-waste, but again, opportunities. For example, since my client bought 3 $4.99 Motorola phones, what would happen if I were to tell them they now have e-waste and might as well go to the dumpster? I may be making a strong point, but to what effect? Polluting in the name of the Church of True Free Software? The devices already exist, and I would rather use an old device than by a new one with the same or worse problems like an android tablet. They are notably worse in that by default, they spy on the user. A few years ago, that was only dreamed about by corporations. Now they can and actually do do it.

As for my actual findings, it turns out one can get along without the WTK if they have a JDK, the reference implementations for the target configuration and profile (downloads from Sun that seem a little less restrictive) and Ant.

There is also an OpenWTK project on Sourceforge that has no files for download and never seemed to take off.

For these phones, I cannot think of what the "next step" towards Free Software is- they can already run it, just not on an operating system level. I guess it is a take-it-or-leave it issue for me right now. Maybe all of you would leave it, but I think it's worth it to "take it" for what it is worth. It really is Free Software that they run, but I understand if everyone disagrees. You all are free to go your own directions. I am not sorry if mine seems a little off-center to everyone here. You have my thanks for your input And I look forward to continuing supporting, running, and building Free Software in the Desktop/Laptop world. I will not be using Ubuntu or anything really crazy like that.

lembas
Hors ligne
A rejoint: 05/13/2010
Jayn
Hors ligne
A rejoint: 08/27/2010

Thank you for the link and I have some good news.

EbookME, a project to get text files on your Java phone in a .jar package, does not require the non-Free Wireless Toolkit from Sun to compile the .jar and .jad files. It is limited in use to the specific application at hand, but all the files can be run with the GPL microemulator that replaces the proprietary Sun one in the WTK. So it does not require non-Free code to run and is thus not a trap.

Even if this was the only use for the phone that is Free, that would be quite a lot, however I did find through the OpenMoko wiki on Java (http://wiki.openmoko.org/wiki/Java) a section on JavaME which has links to several projects which only include GPLv2 licensed versions of the MIDP and CLDC and CDC reference implementations. I need to send the phoneME project an email on how to link things up in terms of an IDE (or maybe I cannot use one with the Free libraries) but things look hopeful and I feel that there is already a Free way to make MIDlets that can be run on a Free microemulator on any Free OS.

I have suspended all my J2ME development until I know I do not need the WTK from Sun (I already deleted it anyways).

Thank you all for firm encouragement.

Jayn
Hors ligne
A rejoint: 08/27/2010

I have found 2 wonderful websites

http://fkooman.wordpress.com/2009/02/16/creating-deployable-midlets-with-free-software/

and

http://tjworld.net/wiki/Linux/Ubuntu/JavaMobileEditionDevelopmentTools

which detail how to free yourself and why from the Sun JWTK. As a non-expert, I can say by following it I have already got it to produce MIDlets that not only work on the GPL Microemulator, but on my hardware phones as well. In using the Proguard processor, which is GPL, I was also able to recreate a program .jar from the source that was a whole tenth of a kilobyte smaller! Things like playing a MIDI sound and displaying graphics also work for me so far. All the non-Free software is gone and I did not even have to wait for an email back from the phoneME project. It turns out that the Microemulator has Free versions of the MIDP and CLDC libraries already!

Thank you all again and I hope this helps if anyone is interested in developing Free MIDlets for J2ME phones and Microemulator.

Jayn
Hors ligne
A rejoint: 08/27/2010

It is hard to believe that it has been over two weeks since I tried to Free my J2ME development, and I am happy to report that I have had no issues thus far with compilation, etc. My educational MIDlet is almost ready for testing on the schoolchildren and I have all of you to thank for the inspiration to refuse to use anything but Free tools. When my code is mature enough, it will be going on the Internet somewhere under a Free license as my way of giving back.

Thanks again, and Happy Hacking!

Jayn
Hors ligne
A rejoint: 08/27/2010

Almost 3 months later, I emerge with a decent demo! The initial hang up was in getting List objects to work for me to produce a multi-dialogue question trial of 5+ questions. That did not work, and any help or insight with regard to that matter would be great. My solution was to use Form objects for the main questions, and to add Commands as answer choices. Alerts with Images pop up when you answer, and when you get to the end, you see a winning dialogue with a ticker and quit Command. As I mentioned, the teacher I made this for works with special-needs students, so the questions are VERY basic mathematics. All graphics are Public Domain from OpenClipArt.org and if you are building the project make sure to put all images in the /res folder. I am not sure how to officially license things, but this is unofficially GPL v3+, you heard it from me. Please use, adapt, enjoy, share feedback, simple though this project may be. It may serve to pique the interest of disaffected students at your school (if you work at one).

My apologies: I am new at compressing things, so you will see my /home/user/workspace/ directories in the archive. There are also some not totally necessary files in the quiz folder, but if you use Eclipse you can just copy the folder to your workspace folder and start hacking from there. Forget what I said about the images, they are already in the /res folder, and one more thing- the installable .jar (and jad) files are under the /deployed/default device/ directory! For anyone who was watching this thread, here you go!

PS: The school's mascot is an eagle, that is why there is one as well as a soaring reference on the last screen.

Pièce jointeTaille
Math-Quiz-Midlet.tar_.gz 107.03 Ko
sphynx
Hors ligne
A rejoint: 11/30/2011

Hi, Jayn,

you can find anything about Licensing at https://www.gnu.org/licenses/licenses.html – in particular, you would be interested in https://www.gnu.org/licenses/gpl-howto.html .

Jayn
Hors ligne
A rejoint: 08/27/2010

I have added a measly 5 questions to my math quiz just for fun. For serious usage, I recommend PlusMinusTimesDivide if you have a Replicant/CyanogenMOD/Android phone. It is a superb math assessment and practice tool that you can get from F-Droid under the GPL terms. The Math teacher I am working with loves it. I am learning slowly and still offer my humble code that is for Java ME phones. Eventually I hope to have a setup where the questions are procedurally generated, but for now, all 10 questions were hand-typed. The graphics are from OpenClipArt.org and are public domain.

Pièce jointeTaille
Math-Quiz-1-1-Midlet.tar_.gz 139.22 Ko