Java Applet Printing dialog won't go away - java

I have a simple java applet that retrieves an image from a server and prints it out. The only problem is that I get the following java security warning:
Researching on this site and all over the web, some people suggest that I sign the applet (I tried that to no avail) and others suggest that I Modify a local java security setting but that isn't feasible for my clients.
Not only do I get this warning at the start of my applet, but seemingly any time the code attempts to interact with the printer, the dialog re-appears. Also, note that there is no checkbox next to 'Always allow this applet to access the printer'. These symptoms show on any browser.
How do I get java to respect the users choice to allow it to send jobs to the printer?

You might use the JNLP API services in a sand-boxed applet in a plug-in 2 JRE. They will still prompt the user each first time they go to print, but should also put an 'always allow' check-box on the dialog (though it really only applies for that run). See a demo. of the PrintService.
See also the applet info. page that includes a link on the Next Generation in Applet Java Plug-in Technology which "..brings new abilities to applets: such as .. allowing embedded applets to gain full access to the services of Java Web Start."

Related

I have made a JFrame which I want to put in an HTML script. (I was going to use a JApplet but it has been deprecated)

I'm using IntelliJ IDEA, I have coded a frame which I want to put into an HTML file so I can run it in my browser, how do I do this now that I cannot use JApplet? I have found this documentation: http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html and this http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html but I am new to programming and find this difficult to follow. I don't know for instance how I would go about putting my class files and the image that I used in a separate directory nor do I know how I go about signing my application so that it will run in a browser.
I want to put into an HTML file so I can run it in my browser,
You can use the Desktop class. This class allows you to access default applications from your desktop.
Read the section from the Swing tutorial o How to Integrate With the Desktop class for more information and working examples.
See Java Plugin support deprecated and Moving to a Plugin-Free Web.
Note that is one of my 'copy/paste comments' that does not explicitly mention JFrame based apps., however the links are still relevant in that Oracle & browser makers would not be phasing out support for applets if they wanted programmers to keep trying to shove rich client apps (e.g. Swing GUIs) into thin client web pages.
OTOH you can offer a JFrame (or a JApplet) to be launched from a link in a web page to end up free floating on the desktop of the user by using Java Web Start.
Even then, it is not a simple matter for the programmer or the end user. The programmer needs to ensure the app is digitally signed using a code signing certificate issued by a CA (usually they are expensive). The end user used to just be able to click the link, 'OK' the prompts produced by the Java virtual machine, and see the app appear on-screen. But now most browsers will download the launch file to the local file system rather than directly hand it to the JVM to be launched. So the user faces an extra step in explicitly finding the downloaded launch file and double clicking it.
This is all due to security concerns related to bugs in the plug-ins that run things in web pages. So if you were to find a way around all these hoops, please let us know. It is a security bug that requires urgent fixing.

Launch an application on button click from a web page

In my web application I need to launch a Windows application installed on client machine when a button in the page is clicked.
I know there are security policies in browsers that avoid this by default, but I also know application that do this. An example could be online meeting, web conferencing applications like WebEx or GoToMeeting.
How they do that?
I'm working with Java, so I'm wondering if Java Applets are an option to achieve this.
Is there some other well known way to solve this issue?
NOTE application execution MUST be allowed by user
The best way to deploy a Java desktop application is using Java Web Start.
And forget applets. Soon Chrome won't be able to load them (along with a number of other plug-ins) at all.
you can achieve it with applet. but user must allow to run it. it is hard to run some extern application from button or link because this is potentially danger behaviour. Remember the applet can not get access to the files on user computer and other servers (unless it is digitally signed)

“Your security settings have blocked a local application from running” Java 8

I am trying to run a small applet in my Chrome window, but am getting the error message.
I do see all the replies telling me to change my security to medium, but that option does not exist in version 8. So far several hours of googling and asking help from classmates has brought no progress.
Can anyone suggest something please?
Medium was removed in Java 8u20:
Medium (removed from Java 8 Update 20 and later versions)
Only unsigned applications that request all permissions are blocked. All other applications are allowed to run with security prompts. Selecting the Medium security level is not recommended and will make your computer more vulnerable should you run a malicious application.
Keep in mind, this only applies to unsigned applets that request all permissions.
What to do
To run these applets, you now must add the site to the exception list under the Security tab when you access your Java settings from the Control Panel.
If the applet is not on a website, you must use the applet viewer, which allows you to run applets outside of a browser

Can I remove any need for dialogs when running a Java applet in the browser?

I am running a Java applet in the browser. However, each browser displays a warning of
"This applet may not be trusted... etc."
and the user is allowed to click Run Anyway or Cancel. This is built in to the browsers / Java configuration. (If the user is running on a security level > Medium, the applet is simply blocked.)
Is there a way for me to sign the applet in such a way that no dialogs appear? Or will they still appear even if the applet is "trusted"?
No, you cannot.
It is no longer generally considered safe to run Java in the browser. The Java plugin has implemented a number of security measures that will display a spectrum of different security warnings depending on the user's current Java security level and the signed status of the applet, but no settings will disable the warnings entirely (short of settings which block the applet from loading at all). Additionally, some web browsers and operating systems have begun to apply their own, separate restrictions to Java applets. For instance, Google Chrome will display a warning bar before attempting to load the Java plugin, and Mac OS X does not install Java at all by default.
If you have any choice in the matter, avoid writing Java applets. Like many other older web technologies, like Shockwave and Quicktime, they are part of the past, not the future.

Can Java Web Start application work inside browser window?

This is the question: can JWS app occupy requin on web page or represent entire web page and/or access browser state parameters?
A Java Web Start application runs independently of the browser. If you want a Java app to interact with the hosting browser, you have to make it an applet.
See the last link in the applet info. page.
JNLP Support in the Next Generation Java Plug-In Technology (introduced in Java SE 6 update 10) goes into further details of the new abilities of applets.
I high-lit the version since it is a recent ability, and I got the impression you wanted to support older browser/JRE combos. from your earlier question.
That page expands..
The next-generation Java Plug-In technology (hereafter the "Java Plug-In") provides support for launching applets directly from JNLP files. Previously, only Java Web Start utilized JNLP files, for the purpose of launching Java applications. Now Java applets can be described using the same meta-descriptor.
Also note that launching an embedded applet using JWS does not solve any of the problems that inherently come with embedding a rich client GUI into the lighter HTML GUI.
Focus problems between HTML elements and the applet or applets. Sun never bothered to try and define what should happen, which resulted in either the applet or HTML getting focus, and that was it (as far as the keyboard went).
Then there is the matter of the PLAF of the applet which mimics, but never quite matches that of the elements used for HTML forms. Especially if they are styled, and that brings me to..
Applets do not respond to CSS! Perhaps intuitively obvious to applet developers, but no end of frustration to the site designer.
Typically there is at least one version of one browser that cannot load the simplest of applets correctly. My 'favorite' of all these type of bugs was a FF version that reloaded applets if the user scrolled 'up'. I could go on, and on, and on..

Categories

Resources