Buddhika Ariyaratne
Buddhika Ariyaratne

Reputation: 2423

Sending data between JavaEE and JavaSE applications

A Java EE application is been developed with JPA and JSF. But it needs advanced printing (like changing the printer and paper depending on requirements without bringing the PrintDialog) and sending fax. A simple Java SE application, running in each client machine, can be developed using Java SE to meet those specific requirements. Is there any way the Web browser can communicate with a Java SE application.

I thought of:

  1. If a XML file is downloaded to a folder where there is the Java SE application which can search to extract the data periodically from newly downloaded XML files, but the download location varies frequently.
  2. Develop a Java Applet,

But not sure about the practicality of the above scenarios.

Upvotes: 3

Views: 330

Answers (2)

kolossus
kolossus

Reputation: 20691

There are a number of options but first among them is the web service option. This is what webservices were meant to solve I.e. bridging the gap between disconnected components.

  1. Taking a look at this answer, you can develop a lightweight web service in JavaSE that wraps the desired functionality

  2. Another option you may explore is the embedded Java EE container. Look at this intro to embedded container development to get you started. While it's similar to option 1, here you get a slightly richer feature set with injection, security and container managed transactions

  3. The spring framework is built to run outside of a container so you'll easily get it's full feature set in a humble JavaSE environment. Within spring, your options for distributed computing are numerous. At the bare minimum, you'll gain a managed context(similar to what you'll get from 2. Above, and also services to plug components of a distributed framework together (JMS, Spring-Ws)

Upvotes: 4

EdH
EdH

Reputation: 5003

Another option would be to put that logic in a Java application and launch it on the client's PC via the web application using Java Web Start. That way, you can keep your web application as it is and then launch the web start application for just the print functionality you want?

Upvotes: 3

Related Questions