Update java with java? - deployment

I was looking around and couldn't find this anywhere, but is there any way to update the JRE through a java application and then to restart said application using the new JRE?

Updating the JRE from within a running Java app. is not something that is commonly done.
Instead look to deployJava.js for ensuring a particular major version of Java is installed, and Java Web Start for ensuring a particular micro-version is available.
These technologies are both related to launching rich clients (applets and desktop apps.) so if the app. has a GUI as mentioned here it should be 'all systems go'.

Related

Tomcat/WildFly - fast webapp auto-reload on IDE compile-on-save?

Is it possible to do what "mvn jetty:run" does, ie. run it against an extracted webapp and auto-reload/auto-restart the webapp if any of the extracted files have been changed?
Beware! I'm NOT talking about updated WAR files and auto-deploying them. My IDEs currently update the class files directly inside the "extracted" webapp file structure.
Context: I'm wondering what (freely licensed, ie apache/lgpl, not CDDL/GPL) Java EE 7 solution provides the fastest roundtrip times for developing test units against the full stack/bugfixing.
I'm also thinking about continuing to use Jetty 9.4, maybe with openejb, because I'm not using most of the JavaEE features anyways. I'm not really a big fan of IoC/DI because if you try to avoid scanning overhead, you put configuration into XML, whereas setting up an embedded server programmatically is strongly typed and cleaner IMHO (remember jetty.xml? programming Java using XML, wtf...). I also don't like JSTL/JSP etc. because templates feel like PHP and j2html seems much more Java-like to me.
But what I want is JPA transaction handling/connection pools for my Jersey servlets. Currently I'm doing that inside a RequestListener, and a more seamless support seems preferable, though not at the cost of being able to run a full stack jetty embedded server in my unit tests without much hassle.
Update
I'm using a simple BASH script using inotifywait now. It simply uses Glassfish's and WildFly's RESTful admin consoles for redeploy:
https://github.com/jjYBdx4IL/snippets/blob/master/bash/jee_autodeploy.sh
It doesn't even deploy the war, instead it simply deploys the build directory. It should be fast enough for most use cases. And if your app grows too large and increases reload times beyond a certain point, one should probably start thinking about refactoring it into multiple modules anyways.
You could try using OpenLiberty, which was released today and is the core (Java EE 7 complaint) subset of WebSphere Liberty. It comes with an eclipse plugin known as "WebSphere Developer tools" and is under the EPL-1.0 license.
http://openliberty.io/

Find Version of GWT Running On Site

Is it possible to send a javascript command to a site and determine the GWT version running in the browser? The reason I ask is because our QA folks are certifying our software and need a way to look at the version running without taking our word for it by looking at the IDE.
I know that I can do java -jar gwt-dev.jar, but normally we do not deploy that with the software.
The built-in GWT linkers generate a $gwt_version variable in the *.cache.* files.
Assuming you don't have other frames in your app, your GWT app will be in the first frame so you can then get the GWT version used to compile it with frames[0].$gwt_version.

Java applets in windows store apps

I have a java applet and i'm developing a windows store app. I want to integrate my applet to this application. Is this feasible.. if yes... can you tell the process.
Thanks,
Harsha
You won't be able to run this within a Windows Store application since plug-ins (you'd need Java installed) are not allowed for WebView (or for the non-desktop version of IE 10 in general - Flash excepted for some sites).
It is not possible at the moment. When you were installing Java you must have missed the Java doesn't work in Metro.
You should probably be able to run your Java Applet into a WebView but I am not sure if that's a good practice or not. You should convert your java applet into a HTML5/JavaScript application or C# application for optimum performance.

Web framework with user-friendly desktop deployment?

I'm building a web app with Backbone.js (I'm not tied to Backbone yet though). I need a back-end framework only for persistence to a database via a RESTful API. However, I also need to able to deploy it as a 'desktop' app for off-line use, i.e. running a local server and launching a browser window, but I don't want users to have to start a server from the command line to run the application.
I can use SQLite as a database since it's only a single user application, it's just the framework that I'm stuck on. I have looked at the following:
Rails and Django: Default web servers are too flimsy, requires Ruby/Python and runs from the command line. I'm aware of the Bitnami stacks but at 99mb it's too big of a dependency and not exactly hidden from the user.
Sproutcore: Run from command line, also too bulky.
Pyjamas Desktop - Depends on MSHTML which I suspect limits my ability to use HTML5 features.
I'm leaning towards creating a Java app that starts a Scala/Lift server instance and opens a web browser, then sits in the system tray (kind of like WAMP). Is anyone familiar with a tool or framework built for user-friendly deployment as a standalone desktop app?
I do not know if PHP is an option for you? Then I would recommend phpdock.
web2py has a standalone deploy-to-desktop feature with no dependency on Python: http://web2py.com/books/default/chapter/29/14#How-to-distribute-your-applications-as-binaries
As Eydun said, phpdock is an option but it's commercially licensed .
I settled on using Java/Spring/H2/Hibernate/Jetty. I find that Jetty serves requests VERY quickly so the application looks real-time when launched in a browser. There is a tutorial on embedding the Jetty server here. I imagine it's quite trivial to build a GUI that launches the server and a browser.
Another Java option is to use the Play Framework, which may be more at home to those coming from a Django/Rails background. However, the documentation for "creating a standalone version of your application" for Play 2.0+ indicates that they have ditched using Java EE containers (Tomcat/Jetty) and WAR files in favor of running the JARs with the bundled copy of JBoss Netty, so it may take a bit of work to get it running the way you want it.
I would recommend the Play Framework approach if you're OK with using/learning Scala.

Oracle or 3rd party service for determining 'latest Java version'

Is there a service available that responds with the latest version of Java that's available?
I'm writing system check for an application that uses applets. As part of the check I'd like to inform users if a new version of Java is available for download. Is there any online service that simply responds with the version number for the latest Java version?
How about a different strategy of 'leave it to the manufacturer'?
The JRE is configured by default to be auto-updating to the latest version Oracle considers to be stable enough for general use. Best leave it to the auto-update feature.
Run-time testing
Of course, there is always How do I test whether Java is working on my computer?
FireFox
An old version of Java has been detected on your system.
Update Java by clicking the button below:
A polite way of saying 'no plug-in found for FF'.
Chrome
User Friendly
But ultimately either way, leave it to the end-user's discretion as to what version to use, and whether to update.