Monday Dec 31, 2012

Creating a Portable Java/JavaFX Rig using the Raspberry Pi

So you're a mobile/embedded Java developer who just can't get enough time with your devices? Need to get your JDK/JavaFX ARM fix on the go? It's easy and inexpensive to do just that with only a few essential parts:

  • Raspberry Pi
  • Atrix Lapdock, which provides portable keyboard/video/mouse and power for the Raspberry Pi!
  • A few cables and adapters (shown in videos, described in linked article below)
  • SD card (8G or more, Class 6 or higher)
  • Edimax EW-7811Un wi-fi adapter

That's all the hardware you'll need to make some serious, very portable ARM Java magic. Total cost was under $120 when I started this adventure; YMMV.  :-)

There are a few differences between setting up the soft-float (SF) and hard-float (HF) versions of Raspbian, but this recent post covers the basics of getting an OS on the SD card for booting and configuring the Pi. The two key differences between SF and HF configuration to this point:

  1. Overclocking. HF Raspbian allows for easy overclocking from the raspi-config utility. A word of warning, though: The OS devs caution that the maximum overclocking setting has been known to corrupt SD cards, and I've found this to be the case several times. Stepping down one level to the next-to-fastest overclocking setting works a treat.
  2. Wi-fi configuration. SF Debian/Raspbian wi-fi configuration can be best accomplished using the instructions in the aforementioned post. Trying the same thing in HF Raspbian results in a message suggesting the use of the wi-fi graphical configuration tool...and it's even easier. With the Edimax, all I did was boot with both ethernet cable & Edimax connected, sudo su, startx, and run wpa_gui under the Internet menu (WiFi Config on the desktop if not root). Fill in your wi-fi details (I used WPA2/CCMP for my WAP) and then File|Save Configuration when finished. Quick, easy, and done.  :-)

Below are links to a couple of short video tours of my mobile Java/JavaFX "testing rig". I'd embed them directly if the Roller blog software supported it (if someone knows how, please let me know!). After the video links is a link to an article/video I used as a template when I originally made mine. Great stuff, fun, and extremely useful...for me, anyway. Hope you enjoy it!

Video 1: Intro to Raspberry Pi & Atrix Lapdock, Part 1 of 2
Video 2: Follow-on to Raspberry Pi & Atrix Lapdock, Part 2 of 2

Reference article/video

Happy hardware hacking,
Mark

Tuesday Dec 18, 2012

Developer Preview of JDK8, JavaFX8 *HARD-FLOAT ABI* for Linux/ARM Now Available!

Just a quick post to spread the good word: the Developer Preview of JDK8 and JavaFX8 for Linux on ARM processors - hard-float ABI - is now available here. Right here.

It's been tested on the Raspberry Pi, and many of us plan to (unofficially) test it on a variety of other ARM platforms. This could be the beginning of something big.

So...what are you still doing here? Go download it already! (Did I mention you could get it here?) :-D

All the best,
Mark

Saturday Nov 10, 2012

Polishing the MonologFX API

Earlier this week, I released "into the wild" a new JavaFX 2.x dialog library, MonologFX, that incorporated some elements of DialogFX and new features I'd been working on over time. While I did try to get the API to a point of reasonable completion (nothing is ever truly "finished", of course!), there was one bit of functionality that I'd included without providing any real "polish": that of the button icons.

Good friend and fellow JFXtras teammate José Pereda Llamas suggested I fix that oversight and provide an update (thanks much, José!), thus this post. If you'd like to take a peek at the new streamlined syntax, I've updated the earlier post; please click here if you'd like to review it. If you want to give MonologFX a try, just point your browser to GitHub to download the updated code and/or .jar.

All the best,
Mark

Wednesday Nov 07, 2012

MonologFX: FLOSS JavaFX Dialogs for the Taking

(UPDATED Nov 10 with simpler button icon API) 

Some time back, I was searching for basic dialog functionality within JavaFX and came up empty. After finding a decent open-source offering on GitHub that almost fit the bill, I began using it...and immediately began thinking of ways to "do it differently."  :-)  Having a weekend to kill, I ended up creating DialogFX and releasing it on GitHub (hecklerm/DialogFX) for anyone who might find it useful. Shortly thereafter, it was incorporated into JFXtras (jfxtras.org) as well.

Today I'm sharing a different, more flexible and capable JavaFX dialog called MonologFX that I've been developing and refining over the past few months. The summary of its progression thus far is pretty well captured in the README.md file I posted with the project on GitHub:

After creating the DialogFX library for JavaFX, I received several suggestions and requests for additional or different functionality, some of which ran counter to the interfaces and/or intent of the DialogFX "way of doing things". Great ideas, but not completely compatible with the existing functionality. Wanting to incorporate these capabilities, I started over...incorporating some parts of DialogFX into the new MonologFX, as I called it, but taking it in a different direction when it seemed sensible to do so.

In the meantime, the OpenJFX team has released dialog code that will be refined and eventually incorporated into JavaFX and OpenJFX. Rather than just scrap the MonologFX code or hoard it, I'm releasing it here on GitHub with the hope that someone may find it useful, interesting, or entertaining. You may never need it, but regardless, MonologFX is there for the taking.

Things of Note

So, what are some features of MonologFX?

  • Four kinds of dialog boxes: ACCEPT (check mark icon), ERROR (red 'x'), INFO (blue "i"), and QUESTION (blue question mark)
  • Button alignment configurable by developer: LEFT, RIGHT, or CENTER
  • Skins/stylesheets support
  • Shortcut key/mnemonics support (Alt-<key>)
  • Ability to designate default (RETURN-key) and cancel (ESCAPE-key) buttons
  • Built-in button types and labels for OK, CANCEL, ABORT, RETRY, IGNORE, YES, and NO
  • Custom button types: CUSTOM1, CUSTOM2, CUSTOM3
  • Internationalization (i18n) built in. Currently, files are provided for English/US and Spanish/Spain locales; please share others and I'll add them!
  • Icon support for your buttons, with or without text labels
  • Fully Free/Libre Open Source Software (FLOSS), with latest source code & .jar always available at GitHub

Quick Usage Overview

Having an intense distaste for rough edges and gears flying when things break (!), I've tried to provide defaults for everything and "fail-safes" to avoid messy outcomes if some property isn't specified, etc. This also feeds the goal of making MonologFX as easy to use as possible, while retaining the library's full flexibility. Or at least that's the plan.  :-)

You can hand-assemble your buttons and dialogs, but I've also included Builder classes to help move that along as well. Here are a couple examples:

        MonologFXButton mlb = MonologFXButtonBuilder.create()
                .defaultButton(true)
                .icon("/testmonologfx/dialog_apply.png")
                .type(MonologFXButton.Type.OK)
                .build();

        MonologFXButton mlb2 = MonologFXButtonBuilder.create()
                .cancelButton(true)
                .icon("/testmonologfx/dialog_cancel.png")
                .type(MonologFXButton.Type.CANCEL)
                .build();

        MonologFX mono = MonologFXBuilder.create()
                .modal(true)
                .message("Welcome to MonologFX! Please feel free to try it out and share your thoughts.")
                .titleText("Important Announcement")
                .button(mlb)
                .button(mlb2)
                .buttonAlignment(MonologFX.ButtonAlignment.CENTER)
                .build();

        MonologFXButton.Type retval = mono.showDialog();


MonologFXButton mlb = MonologFXButtonBuilder.create()
        .defaultButton(true)
        .icon("/testmonologfx/dialog_apply.png")
        .type(MonologFXButton.Type.YES)
        .build();

 

MonologFXButton mlb2 = MonologFXButtonBuilder.create()
        .cancelButton(true)
        .icon("/testmonologfx/dialog_cancel.png")
        .type(MonologFXButton.Type.NO)
        .build();

 

MonologFX mono = MonologFXBuilder.create()
        .modal(true)
        .type(MonologFX.Type.QUESTION)
        .message("Welcome to MonologFX! Does this look like it might be useful?")
        .titleText("Important Announcement")
        .button(mlb)
        .button(mlb2)
        .buttonAlignment(MonologFX.ButtonAlignment.RIGHT)
        .build();

 

MonologFXButton.Type retval = mono.showDialog();

 


Extra Credit

Thanks to everyone who offered ideas for improvement and/or extension to the functionality contained within DialogFX. The JFXtras team welcomed it into the fold, and while I doubt there will be a need to include MonologFX in JFXtras, team members Gerrit Grunwald & Jose Pereda Llamas volunteered templates and i18n expertise to make MonologFX what it is. Thanks for the push, guys!

Where to Get (Git!) It

If you'd like to check it out, point your browser to the MonologFX repository on GitHub. Full source code is there, along with the current .jar file. Please give it a try and share your thoughts! I'd love to hear from you.

All the best,
Mark

Tuesday Oct 09, 2012

Seven Random Thoughts on JavaOne

As most people reading this blog may know, last week was JavaOne. There are a lot of summary/recap articles popping up now, and while I didn't want to just "add to the pile", I did want to share a few observations. Disclaimer: I am an Oracle employee, but most of these observations are either externally verifiable or based upon a collection of opinions from Oracle and non-Oracle attendees alike. Anyway, here are a few take-aways:

  1. The Java ecosystem is alive and well, with a breadth and depth that is impossible to adequately describe in a short post...or a long post, for that matter. If there is any one area within the Java language or JVM that you would like to - or need to - know more about, it's well-represented at J1.
  2. While there are several IDEs that are used to great effect by the developer community, NetBeans is on a roll. I lost count how many sessions mentioned or used NetBeans, but it was by far the dominant IDE in use at J1. As a recent re-convert to NetBeans, I wasn't surprised others liked it so well, only how many.
  3. OpenJDK, OpenJFX, etc. Many developers were understandably concerned with the change of sponsorship/leadership when Java creator and longtime steward Sun Microsystems was acquired by Oracle. The read I got from attendees regarding Oracle's stewardship was almost universally positive, and the push for "openness" is deep and wide within the current Java environs. Few would probably have imagined it to be this good, this soon. Someone observed that "Larry (Ellison) is competitive, and he wants to be the best...so if he wants to have a community, it will be the best community on the planet." Like any company, Oracle is bound to make missteps, but leadership seems to be striking an excellent balance between embracing open efforts and innovating in competitive paid offerings.
  4. JavaFX (2.x) isn't perfect or comprehensive, but a great many people (myself included) see great potential, are developing for it, and are really excited about where it is and where it may be headed. This is another part of the Java ecosystem that has impressive depth for being so new (JavaFX 1.x aside). If you haven't kicked the tires yet, give it a try! You'll be surprised at how capable and versatile it is, and you'll probably catch yourself smiling while coding again.  :-)
  5. JavaEE is everywhere. Not exactly a newsflash, but there is a lot of buzz around EE still/again/anew. Sessions ranged from updated component specs/technologies to Websockets/HTML5, from frameworks to profiles and application servers. Programming "server-side" Java isn't confined to the server (as you no doubt realize), and if you still consider JavaEE a cumbersome beast, you clearly haven't been using the last couple of versions. Download GlassFish or the WebLogic Zip distro (or another JavaEE 6 implementation) and treat yourself.
  6. JavaOne is not inexpensive, but to paraphrase an old saying, "If you think that's expensive, you should try ignorance." :-) I suppose it's possible to attend J1 and learn nothing, but you'd have to really work at it! Attending even a single session is bound to expand your horizons and make you approach your code, your problem domain, differently...even if it's a session about something you already know quite well. The various presenters offer vastly different perspectives and challenge you to re-think your own approach(es).
  7. And finally, if you think the scheduled sessions are great - and make no mistake, most are clearly outstanding - wait until you see what you pick up from what I like to call the "hallway sessions". Between the presentations, people freely mingle in the hallways, go to lunch and dinner together, and talk. And talk. And talk. Ideas flow freely, sparking other ideas and the "crowdsourcing" of knowledge in a way that is hard to imagine outside of a conference of this magnitude. Consider this the "GO" part of a "BOGO" (Buy One, Get One) offer: you buy the ticket to the "structured" part of JavaOne and get the hallway sessions at no additional charge. They're really that good.

If you weren't able to make it to JavaOne this year, you can still watch/listen to the sessions online by visiting the JavaOne course catalog and clicking the media link(s) in the right column - another demonstration of Oracle's commitment to the Java community. But make plans to be there next year to get the full benefit! You'll be glad you did.

 

All the best,
Mark

P.S. - I didn't mention several other exciting developments in areas like the embedded space and the "internet of things" (M2M), robotics, optimization, and the cloud (among others), but I think you get the idea. JavaOne == brainExpansion;  Hope to see you there next year!

About

The Java Jungle addresses topics from mobile to enterprise Java, tech news to techniques, and anything even remotely related. The goal is to help us all do our work better with Java, however we use it.

Your Java Jungle guide is Mark Heckler, an Oracle Java/Middleware/Core Engineer with development experience in numerous environments. Mark's current work pursuits and passions all revolve around Java and leave little time to blog or tweet - but somehow, he finds time to do both anyway.

Mark lives with his very understanding wife, three kids, and dog in the St. Louis, MO area.



Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today