2
votes

Through javaws the jnlp file is tested and it runs fine. But using a browser it only opens the JNLP file as a xml file and does nothing when the url present in the codebase and href of the .jnlp file is entered.

How do I get to download the jar and run it through browser when the required url is entered?

2
Probably your web server is serving the file with the wrong Content-Type header. In order to be able to tell you how to fix that we need to know what web server software you're using. - Ian Roberts
I am using HTTPD Apache web server in CentOS environment. - user2617252

2 Answers

2
votes

Probably Apache is serving the .jnlp file with the wrong Content-Type, so the browser doesn't recognise it as Java Web Start. You need to add some configuration to /etc/httpd/conf/httpd.conf:

AddType application/x-java-jnlp-file .jnlp
AddType application/x-java-archive-diff .jardiff

(find the existing AddType directives and add these lines there) and then restart httpd to make it re-read the config.

Reference (this refers to .htaccess but if you have permission to edit the main configuration file then that will give better performance)

0
votes

I would second the previous answer: Yes, make sure you're server sends the right MIME type. After updating the configuration, test that it sends the right headers using e.g. wget:

wget --save-headers http://..../x.jnlp -O -

And look for the headers with "Content-Type"

HTTP request sent, awaiting response... 200 OK
Length: 1155 (1.1K) [application/x-java-jnlp-file]
Saving to: `STDOUT'
HTTP/1.1 200 OK
Date: Mon, 30 Jun 2014 09:38:05 GMT
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"1155-1402308032000"
Last-Modified: Mon, 09 Jun 2014 10:00:32 GMT
Content-Type: application/x-java-jnlp-file
Content-Length: 1155
Keep-Alive: timeout=1200, max=100
Connection: Keep-Alive

Failing that, in Firefox Preference under Applications, find "JNLP file" and select the javaws executable, so that it will use that to "open" the JNLP file. The Java WebStart executable is called javaws.exe on Windows.