Converting a java web start application (jnlp) to an applet - java

I have a java application which is a java web start application. It is used to administer a remote server. Now I want to convert it to an applet to run in the browser. Is there an easy way to achieve this. What are my options to achieve this? By the way my java application stores and reads some conf files on the client file system. Would this be a problem if I run my application as an applet?

That shouldn't be too hard since Sun/Oracle introduced JNLP support for applets in version 6u10 (1.6.0_10).
In short:
Adapt your app to the applet lifecycle,
set the permissions correctly and
sign it with an official certificate.
(and of course embedd your applet in a web page)

Related

Using Java Spring, Is it possible to run a service that execute on the client side?

I want to create a simple strict service that tells the client if a PDF file is searchable or scanned images (not OCRed). Then I thought that the code is very simple and could run very fast, but the heavy lifting is in uploading the file especially if the file is large. Is there a way in Java and Spring to execute the code on the client's machine (if the client has JVM) by sending the code to the client to be executed and get the result?
Are you looking for Java Web Start?
https://www.java.com/en/download/faq/java_webstart.xml
The Java Web Start software allows you to download and run Java
applications from the web. The Java Web Start software:
Provides an easy, one-click activation of applications
Guarantees that you are always running the latest version of the application
Eliminates complicated installation or upgrade procedures
A signed Web Start application can request permissions to access local resources, native libraries and hardware.
To send the result back to server, you can simply have the Web Start application send it via HTTP[S]. The JNLP used to launch the Web Start application can be dynamically generated, so you can set parameters for the Web Start application, to have it send the parameter back to server, so you can identify which user session it is.

Web application using JSP web application or applet?

If i want to make a web application in java i mean JSP should I create an Applet and put it into a browser or create "Java web project"?
In other words the big companies system like Oracal and others have there own system by creating java web application or using applet and putting it into browsers.
Thanks
I would create a "Java web project".
Using an applet is considered a bad practice due to all of the security issues, the need for the user to install the correct version of java, and enable it in the browser.
Go with a solid java web framework like spring / spring-mvc. See this guide on how to start: https://spring.io/guides/gs/serving-web-content/
Java Applet runs on client side (in the brouser, like javascript), but JSP is part of Java Servlet API and runs on server side (you need to install servlet container like Tomcat to run them). It's not equivalent technologies with different abilities and application area.
Applets are old fashioned now, Applets were used to create interactive web applications in the early days of http development when developing a interactive website was not possible using any browser based technologies like html, css and java script.
But now the things have changed with the evolution of web-2.0. Now you can develop the interactive web application by using only browser based technologies and you don't have to install any third party tools or plugins like in the case of applet, JRE should be installed on client machine.

Chrome packaged app using Java plugin

I am building a chrome packaged app and want to make use of a Java applet. I read in many places that there is a bug which will not allow Java applets to be loaded in chrome due to a proprietary protocol that Java doesn't recognize, namely, chrome-extension://
http://crbug.com/30258
I instead, hosted the java applet on a server alongside an html page that embeds the applet. Then in my packaged app, I am using a sandboxed web view tag to point to the externally hosted page that contains the applet. Through JavaScripts postMessage protocol, I can communicate to the applet indirectly. This worked about a month and a half ago. Since then, I have been unable to have the java applet load in the packaged app. I get Chrome's puzze-piece image and the error message:
This plugin only works on the desktop
I have been unable to load the applet as of recent.
Any ideas?

Java : how to communicate from localhost Java desktop application to Java Applet?

I would know if there is a way to make a Java desktop application to communicate with an applet, in order to call Javascript functions from the desktop app (through applet).
The context :
In one hand, I'm having an ExtJS application (full-AJAX), which is located on a remote server.
In the other hand, a desktop Java application (netbeans application), which is resident (indeed).
What I would do :
Each time one of the apps is used, it sends events & data to the other app.
After a few research, I saw interesting posts here and here, and also an answer on how to communicate between applets (see also here).
The question is not about how to do cross-domain from the applet to the destktop app (see over there and here), but as said in the beginning how to communicate from a desktop java app to the javascript.
Notes
The webapp (ExtJS) is based on a remote server, the applet too. I can locate the applet locally, but it implies to deploy a local webserver.
The desktop app is very heavy, so I cannot convert it in an applet format.
I put the "reverse-AJAX" tag because it is the global concept of what I would do.
If all this is possible without an applet (no Flash please), it's okay too.
In order to call javascript methods from a Java applet in a browser you need to use the Netscape LiveConnect API, there are some examples here.
Basically this is an API that is implemented natively by the browser and allowed a java applet to access the javascript engine of the browser.
Once you have that sorted then you need to call methods in applet from the desktop application, this is a little more tricky. The most easy way would probably be to have an Enum that you exchange serialised instances of to describe the type of event.
There is an example of using sockets for communication here.

How to run jar Files in web Application

Now I have two .jar files: one is a chat Client and the other one is the chat Server. They are running fine on my desktop application, but now I want to upload them to run on my website. What is the best method for doing this? I have the following files:
chatclient.jar
chatserver.jar
Can some one please advise on how to put them in my web page without having to download them when a user clicks on them?
You do not provide enough information.
What would you like to achieve?
What technologies are you using inside the JARS?
Why not package the server jar with a web application ?
Is your client a desktop application, if so, why not to put it in the client's classpath?
Maybe consider having the client implemented in JavaScript using jQuery for example and some web sockets technology,
or maybe using some java web framework or tookit like GWT or Apache Wicket?

Categories