Why install Java separately in a browser? - java

I am trying to understand why we need to install Java within a browser despite having a JDK/JRE installed on the desktop.
When a browser prompts us to install Java , are we actually installing a separate (may be a more condensed version of) JRE ? How is this different from JRE that is installed on the desktop ?
Does the java installed in a browser interact with the one installed on the desktop ?
Say for instance , my web page is running applets. I need to run the applets (bytecodes) on a JVM right ? Why can't the browser just run this on the jre installed on the desktop ?
Can some one help me understand this better ?

Browser can't access JVM installed on that machine/host. It's mainly due to security reason. If it's allowed, just think what not we will be able to do through applications running in your browser. It will create plethora of security problems. Designers have intentionally put this restriction.
To execute applets and some other programs you need a separate JRE/Java for your browser.
And similarly, your host can't use Java installed in browser.

Related

Java Installed vs Java Enabled in browser

Is there a way to detect if java is installed on your machine or if java is disabled on the browser. We use java applets in our application but before the applet is loaded we use "deployJava.js". Sadly even if Java is disabled on the browser it says java is not installed.
So is there way to differentiate if Java is installed or Java is disabled, preferably using javascript. I have also tried using "navigator.javaEnabled()" but it gives me the same result as using "deployJava.js".
You can't.
And that would be very annoying if you could. There's already enough information leaking from the browser to the page, if it started telling people what I have installed but that I have ostensibly disabled, that would be very annoying.
I guess it could be possible and useful to envision an API for that, but in the current state there isn't any: either the plugin is here to be used, or it isn't. It doesn't matter whether it's installed or not.
I guess you'll have to work around it by stating in your user-facing messages that Java either needs to be installed or enabled. Or you could offer to download a diagnostic tool to run it and check it locally, that could be another working alternative, though with the obviously annoying extra-steps to perform (and an additional tool for you to support).
Add a redirect to the HTML page in question. Redirect to javaNotEnabledOrNotInstalled.html (but think of a less descriptive and silly name for it).
Early in the applet init(), call JS to cancel the redirect.
Note also that in the traditional applet element..
<applet
code=..
width=..
height=..
alt='Java is installed but disabled!'>
No Java Plug-In installed in this browser. Get Java free from..
</applet>
In this circumstance, if Java is not installed at all, the user should see..
No Java Plug-In installed in this browser. Get Java free from..
However if Java is installed but disabled, they should see..
Java is installed but disabled!
Here is something js window.navigator.plugin

How to check (on website) if Java is installed on system (*not* in browser)

I have a Java desktop application, and a website where users can download the .jar file.
I would like to have a button on the website that the user can click to check if the application will run on his computer (i.e. does he have the correct version of Java installed on his system).
Please note that I am not trying to check if Java is enabled in the browser (as deployJava.js will do), but instead to check if it is installed on his system.
My users are not very tech-savvy, and I hope to make this as easy as possible.
Thanks for your help.
There is no way to do this via JavaScript. A better solution would be to use a system specific jar launcher that checks if Java is installed and then either installs/launches the java prorgam or outputs an error message.

Can Java web applets do the same as offline ones?

I am looking to start a java web applet, as I need something that doesn't need downloaded (saved to computer) and for the most part will work for Windows and OSX.
I have never done anything with java, so my question is can you do everything you can do with a normal java jar file on the web?
More specifically, can you write a web applet that detect window titles (Like the title of an active window), running processes, look in the windows registry, or find hard drive serial numbers?
The applet needs special permissions for these type of actions. It needs to be signed and trusted by the user.
Have you considered using Java Web start? If the communication with the browser from which the applet is run is crucial, then applets are probably the way to go. Otherwise Java Web start is preferred as you'll face less compatibility problems with browsers' Java plugins and different JVM versions.
Yes, but your applets must be trusted by user (user change some browser security settings)

New Java applet plugin not being used?

I am deploying a signed & trusted applet. We need to run the applet in a separate JVM & increase the heap size. Setting separate_jvm & java_arguments works on our local boxes. Curiously we have clients that though they are using 1.6.0_15 don't seem to be running the new plugin architecture.
When I check their Java config, "use next-generation plugin" is checked & IE7's option "use Java 1.6.0_15 for applet plugin" is also checked. Nothing seems obviously wrong. The Java console also reports the correct version, but neither separate_jvm nor java_arguments are respected.
Just as a sanity check we wrapped the applet in a JNLP & set up our web page to serve the applet with a jnlp_href. The applet tag had a bogus code parameter to ensure the JVM was actually running the JNLP. The Java console complains that it cannot find the bogus class when it should be properly loading the JNLP.
Are there security settings or something else that might cause what I'm seeing?
I'm afraid I've just a few suggestions rather than an absolute answer.
The Java virtual machine version
and plug in version can be
different. Go to Control Panel,
Java, Runtime Environment settings.
When you check the console it may
show the two different versions.
The new plugin architecture would
depend on browser, Opera doesn't use
it at all, for example. IE7 does
though. So check which browser it
works on.
Java has got corrupted due to
repeated installs and uninstalls.
Pretty common complaint I've found.
If you have control over one of the
machines you should uninstall every
Java. Restart machine. Install
latest Java.

Where can I find an applet that requires Java 6?

I currently have Java 5 installed on Windows. I'm trying to test the way the new Java Kernal installs when my Firefox browser comes across an applet requiring Java 6. Unfortunately the applets I try fail to run or just run the Java 5 JVM. I have tried:
http://jdk6.dev.java.net/plugin2/
http://www.psynixis.com/test/HelloJava6Applet.html
http://bfo.co.uk/products/pdf/viewer.jsp
Can anyone point me to other applets that require Java 6?
Try
http://www.java.com/en/download/installed.jsp?detect=jre&try=1
They use an applet in the background to determine the version of Java you are running.
Update: it will tell you the version you are running in the URL:
http://www.java.com/en/download/dt_verify.jsp?plugin=false&latest=false&users_jre=1.5.0
It's very rare to see an Applet that requires 1.6. After all, I don't think any of the things an applet uses require Java 6.
A quicker way to see would be to uninstall Java 5, then try to run an applet... you'll probably be prompted to download Java 6u13.

Categories