Browser downloads jnlp on Java Web Start. How to prevent it? - java

When I click on a link to "web start" my java application, browser downloads jnlp file which I should execute afterwards. Is there any way to force browser to execute jnlp right after the download completes, or event better, to make the whole process transparent, so user just confirms that he wants to launch the application? Thanks.

All you can do is provide the correct MIME type which in a standard setup makes the browser automatically open the file with Java WebStart.
Apart from that you cannot control whether the file is opened or not. Most browsers even have an option which prevents automatically opening downloaded files.

Related

Highlighting the same explorer windows on explorer /select command

We use explorer /select command with the file path to open the file in windows explorer. https://support.microsoft.com/en-us/kb/152457 But on multiple invocations it opens a new window everytime. I am invoking the command from a java application using the process runtime APIs.
is it possible to have one window being opened ?. For e.g. if an explorer with c:/A is being opened ,repeated invocation of the same command must open the same window which is opened. ?
cheers
Saurav
It seems that your problem does not have a simple solution.
According to my understanding the "window sharing" of expplorer is not the explorer's feature. Please take a look on the following article: https://support.microsoft.com/en-us/kb/241911
(Although this article is talking about Internet Explorer I guess it is relevant for file exploerer as well).
According to my user experience the window sharing happens only when you are getting to directory via some kind of shortcut and does not happen when you are running explorer explicitly. For example if you type in "run" window "explorer" the new window is always created, however if you type "c:\" the window will be re-used.
You want to execute explorer with specific option, so you have to run it explicitly, therefore no window re-use can be achieved.
But I can suggest you 2 workarounds.
Do not use /select option. "Run" the base directory of the file you want to select. This will guarantee the window reuse. Then "select" file using java.awt.Robot by "typing" its name.
Manage the opened Explorer windows yourself into your java application. You can store map of file-to-exploerer window handler. When application wants to run open explorer for file that is already selected in other explorer window, activate it. To do this you need some JNI/JNA code. Take a look on the following discussions for details.
In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?
Find out what application (window) is in focus in Java

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)

Delay Java initialization until needed

I have a web page where sometimes I need to communicate with a device.
This device is accessed with sockets, so I have a jar file with the support libraries.
When you want to get data from the device, you press a button, and a javascript method fetches the data using the library (no java code here)
The presence of the jar makes the java machine to start as soon as you load the page.
Since there is a lot of users that don't use this option (usually they don't even have the device, to begin with), they see that as a nuisance.
Is there a posibility to delay the java loading until the button is pressed ?
I don't want to redirect them to another page, that should be done in the same page.
You can load the jar file into a seperate div created dynamically via javascript, at the time you need it.
If you want to consider loading your application with java-webstart-technology, you can implement a button similiar to what oracle has on their page here
Basically what the button does is download the required jars specified in a jnlp-file and launch it.

How to finish java.exe process in applet?

There is an applet on a HTML page. That applet loads a dll library and communicates with an external application through it. I can successfully load and work with that library. That library has functions INIT() and DEINIT().
The issue is when I try to call those functions again, the external app/library says that there is only one process can access to that app. It is an internal check. So I need a way to stop the Java process in order to start the app once again. But if I start the applet once, the Java process doesn't finished until I close the browser tab (or even the whole browser).
Is there a way to stop the Java process in the scope of the browser tab? And I need Java to start as soon as applet in the HTML page will appear.
You can't stop the JVM from the applet, it's managed by the browser.
You might consider switching to a Java Web Start application instead, it's started in its own VM.

Possible to launch JWS applet within browser instead of standalone?

Is it possible to embed an applet in HTML so that it will be displayed within the browser window yet launched through Java Web Start via a JNLP file instead of using the browser's Java plugin? If so, how is this done?
I've only been able to launch my applet in a standalone window, but disliking the user experience pop-ups create, I'd prefer that it be embedded in the browser window.
I'd like to use JWS instead of the plugin because I need to control my applet's maximum heap size, which I don't believe is possible with the browser plugin, at least not on Mac OS 10.5.
In-browser applets support JNLP deployment since 1.5 (or so). There's an example on how to do it here: http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html
You're still using the Java plugin then, of course. It may or may not work to set the heap size.

Categories

Resources