First, thanks for your help so far. Chris Bartlett, your previous answer to my question concerning ShadeDecorator led me to realize that I should be using Panel instead of StackPane.
So, my new question. I'm trying to run an Apache Pivot app on the Raspberry Pi, but I'm having trouble. This question might be better suited for the RPi forums, but I thought I'd start here =) Here is my history so far:
First, I got Raspbian Wheezy running on my RPi (rev. B). Then I installed the JDK 8 pre-release (ARM, hard-float, non-headless) as described here:
And downloaded from here:
Then I copied the HelloJava tutorial (I renamed it "HelloWorld", put it into a package, and added a main()) and the Pivot JARs onto my RPi.
Then I ran the class file with the command:
$ ~/java/jdk1.8.0/bin/java -cp pivot-core-2.0.2.jar:pivot-wtk-2.0.2.jar:pivot-wtk-terra-2.0.2.jar:. com.einnocenttech.HelloWorld
The first error I got was:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
So I added a DISPLAY environment variable as suggested here:
So now I do:
$ echo $DISPLAY
And then I try running HelloWorld again, and I get the following error which I cannot get past:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.Class.forName0(Native Method)
I suspect that I either need to start an X server, or have a better DISPLAY variable. Any thoughts?
Note: X server of Raspbian is compatible with Java ? Just to be sure ...
For faster tests, try with a Linux distribution (on a VM or a real PC), close X and try the same steps ...
Tell us for updates, could really be interesting to have this working.
Il giorno 04/ago/2013 00:04, "Erik Innocent" <[hidden email]> ha scritto:
I'm not a *nix guru, though I can follow guides and the basic concepts. With that in mind, the only way I've figured out how to view a Pivot app on the RPi is to see the graphics output from within the window manager (LXDM, after calling 'startx'). This means doing startx, then either going to another tty via, say, ctrl-alt-f2, or opening the run dialog in LXDM via alt-f2. From there, I call a script that launches the Pivot app. If in tty, I go back to the window manager via ctrl-alt-f7. My current script, as an example, can be found here:
So the good news is that Pivot runs on the RPi. The bad news? Things are unusably slow. I'm doing mostly scaling and placement of SVGs within a panel, with maybe a dozen labels, so I'm guessing it's not my app doing anything crazy intensive. (Or am I wrong?) I've a few ideas for speeding things up, namely:
So, does anyone have any suggestions on how to speed things up? Any input on my ideas? And does anyone know what's going on with pivot-fx? I'd really like to get a Pivot app running on the RPi, I think it would be really cool =)
Thank you so much for your help!
El domingo, 4 de agosto de 2013, Sandro Martini escribió:
Hi Erik, sorry for the delay ...
> I'm not a *nix guru, though I can follow guides and the basic concepts. With
me too :-) ...
Just for info, are you using the RPi with 256 or 512 MB of RAM ? What model ?
> that in mind, the only way I've figured out how to view a Pivot app on the
> RPi is to see the graphics output from within the window manager (LXDM,
> after calling 'startx'). This means doing startx, then either going to
> another tty via, say, ctrl-alt-f2, or opening the run dialog in LXDM via
> alt-f2. From there, I call a script that launches the Pivot app. If in tty,
> I go back to the window manager via ctrl-alt-f7. My current script, as an
> example, can be found here:
all seems ok, if you could open a Terminal/Console directly inside the
window manager it could be a little (but only little, I know) better
... if you can, try to use less dependencies.
On o different PC, try to attach to the running Java process in the
RPi from remote, using JConsole or better, JVisualVM (bundled in all
Java 7 JDKs).
> So the good news is that Pivot runs on the RPi.
great, thanks for reporting to us
> The bad news? Things are unusably slow.
I really think (as many others over Internet) that it's probably due
to the little memory (and poor CPU processing power) of RPi, so any
Java GUI application on it won't be fast ... maybe with some
modularization of JRE (with Java 8 or 9 ?) things should be better
> I'm doing mostly scaling and placement of SVGs within a
> panel, with maybe a dozen labels, so I'm guessing it's not my app doing
> anything crazy intensive. (Or am I wrong?)
try to not use SVG images, and even use small images if you can ...
Last, try if without using bxml files (setup GUI directly in code), if
something is better (but I don't thing this should reduce memory
footprint a lot) ...
> I've a few ideas for speeding things up, namely:
> Using JRE8 instead of JDK8. I don't expect this to yield big gains and can't
> wait for the official release of Java 8 next year
I agree with you
> Using a faster memory card. I also don't expect much from this as I'm not
> doing much disk operation and I don't think I'm swapping out to the SD
a faster memory card could help, but try to check if/how much swap you
are using (and where the OS is writing the swap), and (if possible)
try to disable it (temporary), but attention !!
> Using a faster computer, using Windows. More expensive and less elegant
I know, but of course with limited hardware (and Java memory
footprint) RPi is not well suited for some kind of applications ...
and Windows has always been the de facto standard for GUI applications
> Using a faster computer, using Linux. More expensive and I could have similar issues
no, we have many users under Linux, here all is good ... otherwise
Java wouldn't make sense for us
> Using JavaFX. I'd have to learn another framework, but then I could avoid X,
> which I think is what's slowing things down (I think the graphics are being
> handled by the CPU instead of the GPU). I don't know if JavaFX takes
> advantage of the GPU, but the dedicated link here
> (http://www.oracle.com/technetwork/java/javafx/overview/index.html) seems to
> indicate some level of support.
yes, JavaFX uses GPU, but for whet I know, you always need X under, so
things should be the same even there.
I think that they use a lot Python (and some graphic library/GUI) for
it, this should require less memory than Java.
> Using Weston/Wayland (http://wayland.freedesktop.org/raspberrypi.html).
> Getting Wayland running on the RPi has been a pain and I'm still not there
> yet. I'm guessing it will be built into an upcoming release of Raspian, but
> I can't wait for that. I also worry if it will even help, since the app will
> be going through XWayland (http://wayland.freedesktop.org/xserver.html).
but is/will it be compatible with X ? and with Java ? could be interesting ...
> Using pivot-fx? I'd like to try this but the project
> (https://code.google.com/a/apache-extras.org/p/pivot-fx/) appears to be
> dormant. Anyone know what's going on with this?
I created that project many time ago, but due to lack of interest it's
still empty ...
> So, does anyone have any suggestions on how to speed things up? Any input on
> my ideas? And does anyone know what's going on with pivot-fx? I'd really
> like to get a Pivot app running on the RPi, I think it would be really cool =)
I hope my previous answers could give you some info ... if you need
more, tell to us
> Thank you so much for your help!
thanks to you for your help, I hope we can improve Pivot on RPi (and
other minimal platforms) ...
Anyway, tell us for news.
Thank you for your response, Sandro. I've not yet ordered a replacement for the RPi, so I think I'll try converting SVG to JPG and maybe (if I can get one) using a faster memory card. That seems like the easiest thing that is likely to work. (Question: Is rendering of SVG vs. JPG really that much more demanding?) I'll also try JConsole if I have time. But I think the real issue is just that the graphics are being handled by the RPi's CPU instead of the GPU. Raspbmc (a media server app for the RPi), is a good example of RPi graphics looking snazzy when it's properly configured.
Regarding JavaFX and RPi, check this: "Note that the default configuration of JavaFX on the Raspberry Pi does not use X11. Instead JavaFX works directly with the display framebuffer " (https://wiki.openjdk.java.net/display/OpenJFX/OpenJFX+on+the+Raspberry+Pi) Indeed, when I ran my Pivot app from command line, with no X server running, I got an error stating that an X server was not found. But with a JavaFX demo app, the app appeared on screen. Furthermore, when I started a JavaFX app over ssh, the output was rendered on the RPI's display, leading me to conclude that JavaFX does indeed work directly with the framebuffer, instead of through X.
Regarding Wayland, my understanding is that it is a ground-up replacement for X, meaning that it should be way faster, but will need apps to be rewritten to use it. It also seems to take advantage of the RPi's GPU. Of course, Pivot running through Java 7 needs an X server. Luckily, there's XWayland, which purports to offer back-compatibility for apps that need X. I'm guessing Pivot-via-XWayland would be faster that the status quo because of using the GPU, but slower than slower than, say, a version of Java that uses Wayland directly, because of the X compatibility layer. (It would also probably be slower than JavaFX's direct-to-framebuffer approach.) But I wouldn't know because I couldn't get Wayland running on the RPi =)
So, in answer to your question, I am using an RPi rev. B =D It has 512MB of RAM. I've got 256 of that dedicated to graphics. I might play with this number to see what happens. In any case, I'll let you all know how the progress goes.
On Sun, Aug 18, 2013 at 12:30 PM, Sandro Martini <[hidden email]> wrote:
Hi Erik, sorry for the delay ...
thank you very much for all the info on your tests ...
Pivot uses the standard Java AWT Graphics backend, this is our (and
Java) main constraint.
In JavaFX Oracle wrote a new Graphics backend to have less/more modern
constraints (in multi-platform way, for sure an huge task) ...
So my idea of pixot-fx (at least to try to explore if we could use the
same new backend), but this has still not
Tell us for updates.
Thank you again,
Hey guys, I just tried my app with PNGs in place of SVGs and with a class 10 SD card in place of the class 4 card I had been using. I also ran the app from a terminal from within the window manager, as suggested. The app is still unusably slow =( It did seem slightly faster to me, but not nearly enough to satisfy my clients. So, I'll be dropping the RPi and going with a full-on Windows device. When either PivotFX or Wayland on the RPi happens, I'll try the app again and let you know what happens.
On Mon, Aug 19, 2013 at 9:20 AM, Sandro Martini <[hidden email]> wrote:
> Hey guys, I just tried my app with PNGs in place of SVGs and with a class 10
> SD card in place of the class 4 card I had been using.
> I also ran the app from a terminal from within the window manager, as suggested.
> The app is still unusably slow =( It did seem slightly faster to me,
> but not nearly enough to satisfy my clients.
I'm really sorry for this ...
> So, I'll be dropping the RPi and going with a full-on Windows device.
but the same with your Pivot app on a version of Windows running
JavaSE (just for curiosity) ?
Last, I have seen (but didn't tried) other micro devices like RPi but
with more memory and processing power (and cost) running JavaSE ...
would you consider other solutions like this ?
> When either PivotFX or Wayland on the RPi happens,
note that PivotFX is still just an idea (none is working on it), so a
more real option (for now) could be Wayland ...
> I'll try the app again and let you know what happens.
ok, thanks again.
Good luck for your app :-) .
For development, I'm using a Macbook Pro w/ i7 and 8GB, so it works fine on here.
I'm not too interested in other Linux minicomputers, for a few reasons. One is that, where I live, it's hard to get anything other than mainstream hardware, so if it doesn't work, then I've burned a two weeks and $200 (or more) on shipping and customs. Another reason is that my clients need mainstream stuff since they plan on making several units, and if I'm having problems with something with huge community support like the RPi, what chance do I have with an issue on some random thing from China? But maybe the biggest reason I don't want to go with another Linux device is that in 6-12 months, this RPi issue will (hopefully) be gone when they start packing Wayland with Raspian. Then maybe Pivot will look good on the RPi. After all, the core issue isn't the hardware -- it's that the software (X, not Pivot) doesn't take proper advantage of it. So I'd rather use a placeholder, like an overpowered Windows device, and then try the RPi again when it's ready.
Cheers, and thanks for your time and interest =)
On Tue, Aug 20, 2013 at 4:06 PM, Sandro Martini <[hidden email]> wrote:
|Free forum by Nabble||Edit this page|