Where in the world is javafx.stage.Stage?
From Trephine
| « Trephine vs JavaFX | What can't you do in a browser? » |
[subscribe] Recent blog entries
- Simple prototypal inheritance new!
- Adventures in Rhino - setters and getters
- Site improvements - fighting with Disqus
- JavaScript task chaining
- JavaScript string building benchmarks
- Efficient JavaScript string building
- Alternative JavaScript worker thread API
- Implementing JavaScript worker threads
- Thread safe DOM manipulation
- Site improvements - CSS sprites
- Trephine worker threads made easy
- Pitfalls of multithreaded browser development
- Site improvements - reducing dependencies
- The unsplittability of XML
Live Demos
Where in the world is javafx.stage.Stage?
Yesterday I wrote about trephine and JavaFX hoping to explain that the two are intended for very different purposes and therefore have wildly different characteristics.
It occurred to me that one way to really demonstrate this would be to develop a JavaFX demo in the same vein is the ruby demo to showcase how trephine makes it possible to use any Java scripting platform language. This has been quite a bit more difficult than I had at first hoped.
All went well inintially - the vast majority of the JavaScript code from the ruby demo was directly reusable. About the only thing I had to change was "JRuby" to "JavaFX" and update the list of jars of course. I knew I would need javafxc.jar and javafxrt.jar since I wanted the demo to both compile and run the JavaFX code.
Unfortunately I hit a snag when trying to compile my first JavaFX app:
import javafx.stage.Stage; Stage { }
I tracked this down to the fact that the javafx.stage.Stage package was not in the classpath. Googling turned up some interesting forum posts, but nothing definitively useful. Searching for Jars containing this class was equally fruitless.
So it occurred to me that the JavaFX SDK ought to have the class. I develop on Ubuntu, so naturally I searched for a platform relevant solution and found an article about JavaFX + Maven on Ubuntu. The author was kind enough to include a POM, from which I gathered that Scenario.jar was also needed. I located it in openjdk's lib/desktop directory and took a peek, but Stage was not to be found here either.
Next I looked at other artifacts in his POM like javafxgui.jar and javafx-swing.jar. Lucky for me, these were readily available, but unfortunately neither of these jars contained Stage either.
At this point I remembered that I had once run JavaFX from IE6 in wine, but grepping through all my wine C-drive files didn't turn up any matches to the string "javafx". Repelling ever downward into an empty chasm of desperation, my next move was to begrudgingly install the JavaFX SDK on a Windows machine (it refused to install in wine). I downloaded the NetBeans bundle and started trudging through the installed files.
Lo and behold, there's a file called classes.zip which lives in C:\Program Files\NetBeans 6.5\javafx2\javafx-sdk\emulator\runtimes\cldc-hi-javafx\lib, and this contains a javax.stage package in which a Stage class can be found. So it seems I'll need to add classes.zip to the list of JavaFX dependencies. Unless anyone knows of a better place to find Stage?
Unfortunately I've run out of time to continue debugging for now, but rest assured, I will soon prevail.
--Jim R. Wilson (jimbojw) 13:25, 5 March 2009 (UTC)