Java Raspberry PI Help is Vaadin the best way? - java

I looking to make a web app that has a login page and has 1 button and a image of a LED that will flash.
I started to do this in Vaadin and latest version is so big (32MB in Vaadin files) it take a long time on start on Raspberry PI.
Is there a better way?
Then the button is pressed in software or triggers from the hardware, the hardware could take 1min or more before doing it stuff and flasher LED.
Flash good
Flash's poor
Flash's bad
etc

I assume you want to run the server portion (i.e. the application server) on the Pi?
In that case, Java is not a good choice (though possible), and Vaadin certainly doesn't help as it is a server-side application framework.
Why not use a client-side solution for the UI (i.e. using Angular JS) and a python-based solution for the server-side, based on SimpleHTTPServer (https://docs.python.org/2/library/simplehttpserver.html)?

The accepted Answer by miw is correct. I'll add a bit of explanation.
Vaadin is a great tool for being able to quickly write web apps using only Java programming but rendered using regular web browser clients (no applets).
The Vaadin app actually runs on the server-side. The user-interface is rendered remotely on the client-side (web browser) but the app lives on the server and reactions to the user’s actions are executed on the server.
This server-side execution means a Vaadin web app often needs much memory, enough to maintain the current state and enable the user action-reaction executions for each user, all in the same JVM on your server. Multiplying the users means multiplying the demands upon memory and upon the CPU of the server.
Between both a JVM (Java Virtual Machine) and Vaadin, you would be placing much demands on a resource-limited computer such as Raspberry Pi. While I've not tried it, you should be able to run a relatively simple app with relatively few users. The latest Pi models with more memory (a gig) should work much better. Some competitors to the Pi come with even more memory and so might work better for Vaadin.
So, no, running a Vaadin app on a Raspberry Pi is probably not the most optimal scenario. But it would be fun to try. ;-)

Related

Bundling a browser in my Java application

I have created a Java app (deployed by Java Web Start) which needs to use a browser to display HTML5 content. Due to such browser not necessarily being on the user machine, I'm bundling a portable version of Chromium in my JAR. This has two problems:
The Jar is going to be almost 70 MB, Chromium taking up 64 MB.
There doesn't seem to be an easy way of creating a communication channel between my app running in the background and the browser window, short of bundling a web server as well, like Jetty or Jibble.
The size of Jar isn't such a huge issue, unless it is way over 100 MB. However, the portable Chromium app seems to be windows only and I need to deploy on Mac OS desktops too. At the moment I'm launching Chromium in app mode (with --app="http://..."), because I just need a browser window with no interface.
So my question is, is there another browser I could bundle instead of portable chromium? Something that would preferably be lighter but it definitely has to support HTML5, and that I could control programatically from the Java background app (although a bundled webserver is a viable option, not sure how that would play with various firewalls). Maybe there is something lightweight and cross-platform based on WebKit?
JavaFX2 (this comes with Java 7) comes with a light weight html5 browser.

java to access webcam and pen tablet (standalone app vs applet)

i need to develop in java an application that accesses local resources, mainly a webcam, and possibly a wacom bamboo pen tablet. It should take pictures and notes and then post them to a web server.
The ways i can think of are:
use applets
use some kind of standalone app created via JavaFx (or swing or similar)
Which way would you go about it? Are applets considered a viable/secure way to achieve this?
Thanks
I would go the standalone app route. I always turn Java off in my browsers because I can never remember which specific version has security bugs.
If you build it as a desktop app I think you could quite easily convert it to be an applet later on if you wanted.

How to program remote JVM to display on local desktop without X11 support?

I want to run a light java app on a remote server running linux. It is an old machine so, running X slows things down quite a bit. So, VNC is slow because it relies on X11.
Unfortunately I dont have the code for the remote app. The app requires me to press a few buttons to start the process off. It is frustrating because, the only thing I do with X is press those three buttons.
Is there a way to turn off X on the remote and still be able to do that? Can java somehow project its output windows onto the local machine without X11 support on the remote end?
A GUI application will not work without X11 support (or Windows on Windows) X11 doesn't have to be slow unless you have a very, very old machine. I develop entirely on Linux using X11 and a Swing IDE.
A simple test of you GUI speed is to try the Java2D demo which comes with the JDK. It can be staggeringly slow on some machines, but on a fast machine the "Arc Curves" test can run at 32 frames per second.
My suggestion is to have a realistic exception of what your hardware can do and if its not up to the job, try a faster machine.
A bit heavy-weight, but maybe SWTBot can do it. I guess you'll still need something like Xvfb on the other end.
Google "java client server socket example" search
http://www.oracle.com/technetwork/java/socket-140484.html
Sounds like what you want to do is create a client/server application using sockets to communicate. The first link above is a google search to show several examples of how to do this, the second is a specific Oracle tutorial on the topic.
If what you wanted was to be able to interact with a remote application without using X11 or a Remote Desktop Protocol application, well that is a bit more difficult and I am not sure the result would be worth the effort.

Java web start on iPad

Can I run Java applications (Java Web Start) on iPad?
Looks like this is not possible, but someone suggested using Cloud Browse (an application I couldn't' find) to run Java.
Any solutions?
UPDATE: Cloud Browser is an application that was available on the App Store but it was removed my Apple. Cloud Browse would process the web site externally and then stream the web site content to your iPad screen (something like video streaming).
No, you cannot run Java programs on the iPad (or any iOS device). Apple's license terms forbid running applications that can execute code downloaded from the Internet (which is what Java Web Start is all about).
No, as staffan said, Webstart will not work. However using CloudBrowse, an applet can work. It looks like the idea behind Cloud Browse is that the browser gets rendered on the server and video of the web page get streamed to your phone. This way, it appears to the user that applets or flash are running on the ipad.
I tried CloudBrowse on my IPAD as I've got a Java Applet that runs inside a brower and wanted it to work on my Ipad.
I found that it works pretty well. The Java Applet has a 3D animation, it's not as smooth as running on Windows/Mac through a normal web-browser, but it's pretty good.
I paid for full version, wasn't that expensive and to me, worth it. Opens up the power of using Applets but within Ipad!
Check it out here ... 3D sailing replay.

Developing a mobile version of a site

I'm working on a large website project that makes heavy use of in-page graphing of data. To make the graphs interactive (the old paradigm was to post data to the server, have the server render the graph as a jpg, then send it back to the browser) we've started building the graphs in Java. It's a smooth system, but the website is still very much computer-dependent.
I'd like the site itself to work as a device-aware web application - switching layouts based on user agent strings to render a mobile-optimized version for cell phones and PDAs. But I'm concerned about the nebulous support for 3rd-party applets (Java, Flash, etc) when it comes to platforms like the iPhone.
So if you were building a web application that could be accessed either through a standard web browser or an iPhone/Blackberry/Palm device, what would you do to still display interactive graphs? Is there a workaround for using Java on the iPhone? Is there another platform we should pursue all together?
If you want to support more browsers, you may want to look at using Javascript to help decide what to do.
You could generate the graphs using the canvas element, and if the browsers doesn't support that element then you could use a Flash app, and if that doesn't work, have the graphs developed on the server and use the <img> tag and just refresh.
This third approach could also work if the browser doesn't have javascript enabled.
This way you can handle the various situations and get away from having to run Java in the browser.
The iPhone and Android browsers support HTML5 features such as "canvas", which you may want to look into. The browsers on BlackBerry phones are somewhat behind the times - they are finally releasing a WebKit-based browser for their upcoming 6.0 OS but all of the current in-market devices are quite limited in terms of browser capabilities. For those devices you're probably best off just using a static server-generated image.
I would use a JS charts library and gracefully downgrade to images when you detect an older browser.

Categories