I am in a serious confusion since this morning after the project meeting .. I am very much new to java, I have worked as Application Supporter before, but java seriously ruffled my mind.
My Question: I am developing a web based application using Servelts/MYSQL, and my boss wants me to develop another application which was already developed before and he has lost the code, I have to develop that app again, But I don't want to use servlets for my 2nd project.. I think I can do that application using Swing or GWT, or AJAX, now that problem is have to integrate my application with my first application. How to covert Swing application to Servlet app, I am worried a bit. Your help and suggestions will be appreciated.
You can't convert a Swing application to a web application, at least not in an easy way.
An option would be to create your 2nd application as an Applet, that way you could use Swing and you could integrate it fairly easily into your web application.
There is another option:
Deploy and run Java Swing applications in browser by automatically converting them to HTML/JavaScript.
This is however not a free service/solution and I can't give further advice on this.
But since you have to rewrite the 2nd app from start (which you wanted to do using Swing), you'd better do that as a webapp as well, and then you will have no problem integrating it into your first application.
GWT is already very similar to Swing (you can create GWT apps mostly using Java code, it uses components called widgets, panels, events and event handlers) so if you create your webapp using Google GWT, it will be easy to do your 2nd app too.
Related
As Java developer, I always felt comfortable developing web applications using GWT, but every now and then I am trying to check if there is a better framework that I can use for developing a large scale web application.
I tried out React, and I liked it, but as a Java developer I am not feeling as comfortable developing using JS, and I am scared that when the project will become really big I will have troubles maintaining it, and I will get "spaghetti code".
Basically I wanted to know what are the benefits of React over GWT? and am I right to be scared of big scale projects developed in JS?
Now you could try VueGWT: Github project
The idea is to write your control in Java and your views with vueJS templates. We have started (only a few part for now) to use it for GenMyModel, a very big GWT application.
I'm a java born developper who now works in react-redux and miss the object language. If you try to develop a real good application you will have to add redux to react but its pattern is quite weird and not well documented.
If you feel more comfortable with Java than JS you should use GWT. It's true that ag-grid with infinite loading for example, may not exist in GWT for the moment but you have Google support. If you want the latest amazing widgets (the react virtualized select is another example) for your app and you really need them you will have to document yourself about these (with lacks of documentation) and use react.
I have been trying for the past week or so to wrap my head around how I would go about creating a web application using java. I have looked into many services such as Vaadin, GWT, and CUBA, but because I don't really know which I need I haven't had much luck. Here is what I need:
Web application framework in java (I don't know HTML or Javascript)
Ability to use polymer elements
I would also prefer a minimized use of XML files, but I could work with them if need be.
The Java framework for web development is J2EE. It provides a Web Container to run web application (.war file) as well as other stuff.
Web application can be servlet, JSP etc.
If you are not familiar with Java Web Application, you may want to start with using Eclipse. The following video shows how to use eclipse to build a project for web application
https://www.youtube.com/watch?v=Av6zh817QEc
Since one criteria is to use Polymer I recommend having a look at
gwtmaterialdesign
there are already a few tutorials how to get started and also ready to use templates.
Anyway I believe that you've to dig a little into GWT ...
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).
We have two applications which solve different business tasks. One is based on Eclipse RCP. Another is web application based on Java server technologies.
Currently we need to develop one common component. It is for scheduling events. One group of users use Eclipse RCP application and will create and plan some events. Another group of users access web application and will view these scheduled events.
It is rather obvious, that it would be great if we can create one reusable component and integrate it with Eclipse ECP and Java web app.
The problem is what framework, technology, architecture to choose to solve this task.
The component should be developed once and be reusable.
It should have similar GUI in Eclipse RCP and in Java web app.
The component integrated with Eclipse RCP should support offline work. So users should be able to schedule events without having Internet connection and somehow upload/merge their local version with online in web app later.
Do you have any ideas, recommendations?
If you need some additional information about the task and its requirements, feel free to ask, I will edit this question to have as full and clear description as possible here.
The only technology I know of which approaches what you are looking for would be:
Eclipse RAP
(source: eclipse.org)
RAP is very similar to Eclipse RCP, but it has its own implementation of the SWT API (called RWT) which renders the widgets remotely on a web browser. The RAP application runs on a servlet container and clients can access the application with standard web browsers.
The idea is that a autonomous RCP application and its equivalent online RAP one will share almost all their code, except from web-specific bits.
I have designed a GUI connect to DB button using Swing in java now i want to make it webapp application I need to host it on my website. Do i need to replace all my coding as swing is only for desktop application. Or is there any other way?
It will partly depend on how well you've structured your application. If there's no layering involved - if the GUI classes connect directly to the database, for example, then yes, you'll need to rewrite the whole thing.
If, however, you already have a separate data access layer, business logic layer and presentation layer, then you may only need to completely rewrite the presentation layer - while checking the other layers for things like concurrency safety.
The stateless nature of web applications - aside from session-based state - may mean you need to redesign the application significantly, of course. This may in turn mean that your existing "backend" layers aren't quite appropriate. While the theory is that they'd be presentation-layer-neutral, in my experience it would be quite unusual to manage to write an app targeting a single UI technology without some of the usage assumptions leaking through into underlying layers.
Check GWT, its a great framework that allows you to code in java...
If I'm getting it correctly, you need to reuse a database connection code. In that case:
You need to remove only the code that references Swing components. The ones that start with J. More accurately - the ones that are in package javax.swing or java.awt. The rest of the code can stay.
However, if your database connectivity code is too coupled to the GUI code, you'd better start that from scratch and just copy-paste of the parts in your Swings application.
In case you have a big Swing application, then you might want to use an automatic converter to web (ajax) application instead.
One such solution is AjaxSwing. There may exist others as well.
Take a look at AjaxSwing. It is a web deployment platform for Java Swing applications. It allows companies that built Java desktop applications to run them as web applications. Because it produces pure HTML/JavaScript you can also run Swing application on iPhone, iPad and Android phones.
Yes you need to replace all the GUI layer with web-app stuff (jsps, controllers etc). It should be relatively easy if you kept the business layer separated from the GUI layer. I suggest taking a look at Spring Framework, it is very useful for developing web apps.
If you want a Swing like application on the web, you can use an Applet.
You can turn your swing application into an applet, then it will run in a web browser, provided a JRE is installed on the client machine.
What can be reused depends upon your architecture. Look at Wicket, which offers a programming model very similar to Swing. That would not avoid rewriting of the GUI but makes the "mental mapping" easy.