Chrome packaged app using Java plugin - java

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?

Related

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.

Webview in an Applet not working from a self signed jar

I have made an app using Java FX and WebView. Everything works fine when deployed as an application in a standalone jar. When I try to integrate the same as a browser embedded application (applet), I can see the interface which I've developed, but no URL is loading.
After googling, I came to know (from the JavaFX deployment documentation) that I have to sign my application. I did self sign my application and tried to run it. But it still did not work.
Do I have to obtain a secure certificate for running WebView in browser?
This browser embedded application is for internal usage and not for wide distribution.

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

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)

Execute code on client side

I have a requirement where a jar deployed onto client side needs to be executed when a user click on a link on web page [it's an internal webpage]. To elaborate, I have a web page which provides details regarding multiple products, now when individual product owners click on their products then product specific jars need to be executed to open Swing UI.
I have done analysis on this and none of frameworks of libraries allow this due to security reasons from Run EXE from client side.
I suggested to perform this using applet but people are not keen on it.
EDIT:
Reason for excluding applet is that people are not keen on deploying jar on server. They want to deploy jar on client side and then execute it.
EDIT:
Reasons for not being keen on downloading jar are:
Jar is huge, in some cases around 100 mb.
If jar has to be deployed on to web server then a dependency gets added which products want to avoid because they do not want to sync up with release cycle of web application.
Are there any options to execute client side code under some checks? For example: Setting a particular IP address as secured in order to by pass security checks.
Java Web Start is probably the way to go for this deployment.
The issue people do not want to download the jar, they want pre-installed jar to be executed
The point is that 'the user' does not download the Jar, instead that is done invisibly by the JWS client that runs the launch file the user clicked. Try my JWS version of GIFanim for an example of the experience.
Note that even though that app. is sand-boxed, there are still prompts before it reaches the screen. Since version 1.7.0_21 those prompts apply to both applets & JWS apps.
Ultimately, there is no way to run a Swing based app. before the Jar is downloaded. E.G.:-
User downloads executable Jar & runs it. They need to download the Jar in a situation where it is clear the Jar is being downloaded.
Applet. The JVM will be invoked when the applet element (or equivalent) appears in a web page. The JVM will download & cache the Jar - relatively invisible to the user, excepting the 'loading..' progress bar in the applet.
Java Web Start. The JWS client will be invoked when the user clicks a link to a JNLP file. That JNLP will be cached locally, then the resources (Jars etc.) will be cached locally, then the app. will be run. Again, relatively invisible to the user, barring the download time and any related progress indicator (which JWS does by default).
..when individual product owners click on their products then product specific jars need to be executed to open Swing UI.
You would have a JNLP for each 'more specific' app. as well, then you might use the BasicService of the JNLP API to invoke the relevant app. by opening the JNLP of that app. Here is a demo. of the BasicService.
use web start
see this link
http://www.oracle.com/technetwork/java/javase/overview-137531.html
web start allows the client to run java application where the jar reside on the web

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.

Categories