i want to know if it is possible to create GUI for java desktop based application in Adobe FLEX.
or any other powerful framework to make rich GUI interfaces for Java desktop applications.
Please share your valuable views on this.
i want to know if it is possible to create GUI for java desktop based
application in Adobe FLEX.
Yes, no and sort of. Flex is primarily used in client server applications. If you have a java server that exposes functionality via web services there is no reason you can't write a Flex GUI on top of that. And there is no reason that GUI can't target a browser (with Flash Player) or the desktop (with AIR).
There is also no reason that the client and the server cannot be the same machine. It will however present a significant installation challenge in deploying this application. I'm not sure if these challenges outweigh any benefits that Flex may bring to the table.
Ignoring the client/server nature of Flash/AIR, you can use Native Extensions or NativeProcess to include and execute Java Code as part of an AIR application. This is probably the approach I would take if I really wanted to use Flex and Java together in a desktop application.
Related
I need to build a desktop application for internal users for certain business. It also needs web based GUI for external users. I know, with web GUI both internal and external users can access it, but there are certain factors which are outside our control - due to which, desktop application is really unavoidable. For the purpose of this question, I would like to focus on the way to support both Desktop client (Swing) and Browser client.
Are there any best practices to be followed? I could think of below:
Expose service classes as web services and use these from both Swing client and web client
Expose service classes as EJB (business is into Java EE techs) and use Swing client as EJB client. Web client can use controller classes to interact with EJB
Are there any known benefits of using either approach, apart from technology agnosticism offered by web services?
Also, for swing client, I am thinking of using Java Web Start for easy distribution. I have never used it before, but from what I understood, it can support automatic version check at startup and update the client when required - is this correct?
If you need to avoid dependency to Java/JVM on the browser (which you most likely at least want to), you should definitely go with mixed Swing-Vaadin approach. Build the internal application with Swing or JavaFX and web part with Vaadin. The programming model in Vaadin is so close to typical desktop UI library that it is really easy for the same developers to work with both code base, and naturally you'll use exactly the same backend.
See the example application I recently built to demonstrate a setup like this.
I have a fairly large Java application in production (30k lines of code). It uses a decent sized library of business objects I wrote in Java and I have a Swing interface thrown on top of it.
However,it functions as a standalone desktop application currently with no server-side at all (except for a MySQL database and some text files housing central data). As data volume and calculation needs increase, this is becoming a problem running on just a quad core workstation with five threads and 4GB of RAM.
I'm thinking of going the modern route and create a web based application using PHP, HTML, CSS, Javascript, etc. However, I don't want to rewrite my Java business object libraries from scratch in PHP (and I dont like the loose type style of PHP). I'd prefer to keep everything in Java so I can use my current business object library. That way I only have to scrap the Swing interface and serve up dynamic web pages instead, and have a Java server use the current business object libraries to calculate everything.
I've done research but I dont know what I'm looking for as there seems to be several disparate options. Does Apache have a Java web server solution or something that accomplishes this? What is the best way to transform a Java application into a web application?
Rewrite the UI layer with Vaadin. Vaadin UI code is almost like Swing code and is executed in the JVM (typically in Java EE server or in plain servlet container with e.g. Spring). That is why you can most likely recycle the most essential parts of your application.
I know that I can convert a Swing application to an Applet or a Java Web Start application. Is it possible to do the same with an application that's not Swing, say Qt using Java?
What I'm really looking for is a UI framework using Java that's as cross-platform as possible and also has a rich set of UI functionality. Being able to run the application as either a desktop or a Web application would be preferable.
What I'm really looking for is a UI framework using Java that's as cross-platform as possible and also has a rich set of UI functionality.
Assuming a desktop deployment, the three major frameworks are Swing, SWT and JavaFX.
Try the JavaFX Ensemble sample to see if that technology would suit your needs.
I know that I can convert a Swing application to an Applet or a Java Web Start application. Is it possible to do the same with an application that's not Swing, say Qt using Java?
QT is native code that doesn't run on the JVM - it is not a Java UI framework. Applet and Web Start programs require a Java class as their entry point. Any use of QT is such a scenario would require a Java <=> QT adaption layer and I am not aware of the existence of any such thing - you would probably need to build it yourself based on a technology like JNI.
Being able to run the application as either a desktop or a Web application would be preferable.
See the JavaFX deployment guide for various JavaFX deployment options and the Swing deployment guide for various Swing deployment options.
The definition of Web application is pretty nebulous. Here are some distinct scenarios:
You are restricted to just html5 => produce the html on a server to
distribute to the client.
You want html launching a Java
application => then something like WebStart in combination with the
Java Deployment Toolkit can be used.
You will be rendering a
JavaFX application inside a browser window => then use a browser embedded app.
There are many pitfalls for embedding java applications is web pages (just use google to discover some of them).
What I have done in one of my projects is develop the application as a web application and then generate a installable to distribute my application. This has great benefits:
It can be installed in a server and publicly available. Just as a normal web application.
It can also be installed in a desktop.
I used "Jetty" to embed the web server in my application and be able to run the application as a stand alone in desktop environment. The slogan of Jetty is "Don't deploy your application in Jetty, deploy Jetty in your application."
Also I used "IzPak" to package my application in a executable JAR for installation. If you want to make that JAR easy to install for people who might not have installed Java you can use launch4j which is a tool that wraps the JAR into an EXE. So it can validate first if the computer has already Java and if not inform the user that he needs to have Java installed to proceed. The only drawback of this is that if you wrap your application in an EXE you are limiting the portability to other platforms, but that's your decision according to the requirements.
Java Web Start apps can contain native libraries, so yes you should be able to convert an app using Qt (assuming the bindings exist) to a JWS app.
Applets on the other hand are tricky to make work with anything other than AWT/Swing, since you have no control over the creation of the top-level window.
If you want to use Qt you would first have to make Qt bindings for Java as they are not currently functional.
If you want to use Qt bindings from a Java Applet you will need to make your bindings an installable extension which would be a potential security risk unless you know what you are doing. You would also have to get the user to install your extension. Also IcedTea-web which are the FOSS plugin shipping with Linux will not load an extension. So if you want your extension to work on Linux you will have to fork IcedTea-web and make your own plugin.
So the short answer: Stick to Swing.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 months ago.
Improve this question
I would like to create a desktop application in Java & web technologies. The main reason for selecting Java is that it is free, open source, and hence our investment would be minimal and we would save lots of investment with respect to licensing costs, etc. Also, the main reason for selecting web technologies is because our current programmers are well versed with web technologies like HTMl, css, Ajax, and we have good experience in creating amazing UI in web technologies.
I will give you some idea about the software that we would like to create. It would be a desktop based software, namely something like an ERP software.
The key requirements are that there should be a great UI and it should be fast and not very resource intensive.
I have heard that implementing a great GUI is possible, but difficult in Java. It can be done but is complex, whereas it is pretty simple to do the same in Visual Studio, Microsoft products.
I have also checked Adobe Air, Nokia QT, etc but they all are pretty expensive for us and we are looking for front-end browser UI and backend embedded server/database using java technologies.
Is it possible to create a desktop software in which the UI is created using the web technologies and there is an embedded server (like jetty or tomcat) and database and the backend programming would be in Java. How does JavaFX fit into this?
So basically, the desktop application would have an embedded browser (mozilla or some java browser which can packaged with the software), but the end user should never realize this.
I look forward to getting feedback about the same. Can you please provide some examples of software created in a similar combination of java + web technologies.
I did study some softwares like PulpTunes & Zimbra which were along similar lines, but they seem to be connecting to internet to display data. Our software would be totally an offline desktop application.
First of all, it is possible. If you are looking for example, check http://wiki.eclipse.org/Hudson-ci/Meet_Hudson.
You can get basic architecture if you dig into their code. It does not use any embedded db.
You are saying your application will always be offline, in that case I suggest you to go for pure desktop application using technologies like Eclipse plugin development.
If you already made up your mind, here are some points that can help you based on my experience with similar application,
Although your application is offline(I assume, your application need not connect to any server for any use case but the user machine can access internet ), you need to deliver changes(for example, change in html or jsp page )/bug fixes transparently to end user. JNLP/Java web start is a good fit for this.
If you are going for JNLP way of installing, you launcher should take care of embedded db installation and ports at the end user machine(this is big problem than it appears).
Also if you are launching server(in my case, Jetty) through JNLP, you will come across Class loading errors due to permission issues. Be prepared to dig through server code. I have done it long time ago and I do not have code now to point exact issues.
Show progress bars during installation process and during your application startup. Your war deployment takes some time and user needs some of knowing that application is startup is in progress. You will end up writing some swing UI.
Launch URL of the application automatically in default browser of the user system, after application startup. You do not need embedded browser.Check http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/.
I used MySql as embedded data base. Check Embedding mysql in java desktop application. It worked for me, I did not come across any problems.
Yes, it is possible. See https://github.com/jreznot/electron-java-app demo. There you will find an easy way to build Electron based application on Java, without compilation to JS, just Java application inside of embedded Jetty instance with Vaadin UI.
You are truly right, java is great if you are developing a project by self.
Server side coding can be done using Spring (For MVC, Database etc...Very rich and ligthweight framework, easy to learn and understand) with hibernate(ORM framework for Database handling, provides dialects for any Database server).
For UI, you can use Spring MVC OR JSF OR GWT OR javaFX. JavaFX provides JNLP download, which runs on java and without browser. check the link for more JavaFX samples. http://javafx.com/samples/
So its on you, what you want to use for UI side. If you prefer web UI (Not javaFX i mean) then you can have many options.
For Ajax, you will have libraries which support easy ajax. like DWR (Easy Ajax, JS to JAVA) and many other JS libraries like yahoo, jQuery etc.. can be used.
hope this helps.
IMHO the whole idea of running a web-server just to create a desktop app with js and ajax and stuff is horrible... I heard about Apple-creator Titanium which is allows to create crossplatform apps using web techniques. There are couple other similar programs as well.
I think you'll end up better buying a good wyswing Swing design tool for java ui which will cost you couple hundred bucks but will save you lots and lots development trouble. It is very hard to believe that laying out a nice desktop app is more complicated than laying out a web page.
I didn't get the embedded jetty/tomcat part. You want the desktop app to run an embedded server that talks to the database? So each desktop app would open a DB connection?
Why not have a Java desktop app that sends HTTP requests to a JavaEE server that connects to the DB and processes the requests? So basically, a Java client (which could be as rich as your developers can make it) replacing a browser. This gives you a lot more scalability, etc.
We have a similar (albeit much more complex) product developed using
- Swing + Apache Commons HttpClient on the desktop. This makes an HTTP POST request with serialized binary data to the server.
- A dispatcher servlet running in a web container that recreates the Java object on the server and executes the request.
I will probably get stoned for this, but I suggest JavaFX for this. We have successfully implemented a JavaFX-application for internal use in a larger company. The advantages are that the software is "controlled" on the server side (thus, nobody will have an "old" version). Installation effort is minimal (Java Web Start fixes this for you, it will even trigger a minimal JRE-installation if none exist) and last but not least, JavaFX can be run in the browser and as a pure desktop application alike without having to change the code.
Adobe FLEX is another contender, but it lacks the "Web Start" bit and is not quite as flexible when it comes to easy migration between browser and desktop.
Anyway, JavaFX is not quite feature complete as FLEX but version 1.3 can be considered battle-ready and you can create neat stuff with the free JavaFX plugins for Adobe Creative Suite (if your app will contain any graphics, that is).
I am used to develop web applications in Java (Struts, Spring, JSP...). But now I want to develop a desktop one. I never liked to design windows in Java (AWT, Swing, SWT): too much work for an ugly interface. So I think it could be a good idea if could take advantage of my web-app skills. One option is to modify the SWT Browser and make calls to a Java function instead of HTTP requests. A very good add-on would be use of JSP. Finally, I thought that probably there is some framework or tool for this.
Do you think that what I propose is a good idea?
There is available some framework for this?
I need this for light applications. So I think that embedding an Tomcat server and using it with HTTP requests is not a good idea.
Edit: One example application could be a folder comparer: you specify two folders and the app shows you which folders and files are different. In this case, I think opening an external browser is ugly. Bloated application (with its server, MVC, etc) wouldn't be the best choice.
If you have used the JavaScript library - ExtJs - then you can use it with Adobe AIR to build good looking desktop based web app.
Building app's in Adobe AIR is also simple and elegant with the flex builder ide.
If your option goes to embed a light server, check winstone is not fully J2EE compliant but should be enough for what you need.
About the browser, I am not a big fan of swt myself, it complicates a lot cross-platform deployment, so probably worth to keep an eye on jwebpane, not quite ready yet, but probably the solution you'll need.
I wouldn't discount embedding a web server. I've done this before with a web start application embedding Jetty.
The download was pretty fast, the server starts up and you can use BrowserLauncher to immediately drive your browser to the embedded server, and hence your application. Jetty is designed to be modular and have a small footprint, so you can probably cut it down to the bare necessities.
There are several options: You can use the plugin API of Firefox and develop your app in there. You can use HTML, JavaScript, the built-in database, all the browser features and access the OS level.
Or you could try PyQt (Python and Qt) which allows to write simple applications very quickly.
[EDIT] The main problem you're facing is security: For security reasons, JavaScript apps (running in a HTML page) can't access local OS resources. So unless your browser allows you to write plugins in JavaScript (which is only true for FF AFAIK), there is no way to write an application which uses HTML as the "view" without the help of something else.
Moreover, HTML is very limited when it comes to features for applications. HTML is designed to be a "static document view" not an "application". You can do things like GMail but if you compare GMail to any real mail app (Outlook, Thunderbird, Notes), you'll see quickly that real desktop apps offer a lot more features.