473,757 Members | 8,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

detect version of java installed?

Does anyone know how to detect the version of Java installed?

My website has an application that requires java 1.5+ to be installed,
basically if the user doesn;t already have it installed I redirect them
to the java download page...

thanks!

Oct 22 '06 #1
4 11483
ao****@hotmail. com wrote:
>Does anyone know how to detect the version of Java installed?

My website has an application that requires java 1.5+ to be installed,
basically if the user doesn;t already have it installed I redirect them
to the java download page...
You're in the wrong group, we discuss Javascript, not Java. The two
are completely different.

Try comp.lang.java. programmer

--
Tim Slattery
Sl********@bls. gov
Oct 23 '06 #2
Tim Slattery wrote:
ao****@hotmail. com wrote:
>Does anyone know how to detect the version of Java installed?

My website has an application that requires java 1.5+ to be
installed, basically if the user doesn;t already have it installed I
redirect them to the java download page...

You're in the wrong group, we discuss Javascript, not Java. The two
are completely different.

Try comp.lang.java. programmer
Not a directly JS related question, I agree, but I have a small applet
that I use in conjuction with JavaScript to determine exactly what the
OP is after...

here's The Applet Code...:

import java.applet.App let;
import java.awt.Headle ssException;
import java.awt.*;
/**
* @author Dag Sunde
* @version 1.0
*/

public class Detector extends Applet {
public Detector() throws HeadlessExcepti on {
}

public void init() {
add(new Label(getJavaVe rsion()));

}
public String getJavaVersion( ) {
return System.getPrope rty("java.versi on");
}

}
And here's the HTML/JS with how to use it:

<head>
<script type="text/javascript">

var VERSION_REQUIRE D = "1.5.0";

function checkPlugIn() {
// Check for Java Plugin Version
var javaVersion;
try {
javaVersion =
document.getEle mentById('detec tPluginApplet') .getJavaVersion ();
}
catch (e) {
javaVersion = null;
}

if(javaVersion == null) {
alert("No Java Plugin detected");
}
else {
alert("Java Plugin version " + javaVersion + " detected");
}

if ( javaVersion >= VERSION_REQUIRE D ) {
alert("You are cleared to procede...");
}
else {
alert("You must go to the java download page to get the correct Java
Plugin...");
document.locati on.href =
http://java.sun.com/javase/downloads/index.jsp;
}
return true;
}
</script>
</head>

<body onload="checkPl ugIn();">
<object classid="clsid: 8AD9C840-044E-11D1-B3E9-00805F499D93"
id="detectPlugi nApplet"
data="Detector. class"
type="applicati on/x-java-applet"
codebase="."
width = "1"
height = "1"
align = "middle"
vspace = "0"
hspace = "0"
>
<param name = "code" value = "Detector"/>
<param name = "codebase" value = ".">
<param name = "mayscript" value ="true"/>
<param name = "scriptable " value = "true">
<param name = "progressba r" value="true" />
<param name = "boxmessage " value="Laster detektor applet"/>
</object>
</body>

--
Dag.
Oct 23 '06 #3
Thanks!

But I tried this, getting the java plugin always results in an error!
(making the javaVersion == null)....


Dag Sunde wrote:
Tim Slattery wrote:
ao****@hotmail. com wrote:
Does anyone know how to detect the version of Java installed?

My website has an application that requires java 1.5+ to be
installed, basically if the user doesn;t already have it installed I
redirect them to the java download page...
You're in the wrong group, we discuss Javascript, not Java. The two
are completely different.

Try comp.lang.java. programmer

Not a directly JS related question, I agree, but I have a small applet
that I use in conjuction with JavaScript to determine exactly what the
OP is after...

here's The Applet Code...:

import java.applet.App let;
import java.awt.Headle ssException;
import java.awt.*;
/**
* @author Dag Sunde
* @version 1.0
*/

public class Detector extends Applet {
public Detector() throws HeadlessExcepti on {
}

public void init() {
add(new Label(getJavaVe rsion()));

}
public String getJavaVersion( ) {
return System.getPrope rty("java.versi on");
}

}
And here's the HTML/JS with how to use it:

<head>
<script type="text/javascript">

var VERSION_REQUIRE D = "1.5.0";

function checkPlugIn() {
// Check for Java Plugin Version
var javaVersion;
try {
javaVersion =
document.getEle mentById('detec tPluginApplet') .getJavaVersion ();
}
catch (e) {
javaVersion = null;
}

if(javaVersion == null) {
alert("No Java Plugin detected");
}
else {
alert("Java Plugin version " + javaVersion + " detected");
}

if ( javaVersion >= VERSION_REQUIRE D ) {
alert("You are cleared to procede...");
}
else {
alert("You must go to the java download page to get the correct Java
Plugin...");
document.locati on.href =
http://java.sun.com/javase/downloads/index.jsp;
}
return true;
}
</script>
</head>

<body onload="checkPl ugIn();">
<object classid="clsid: 8AD9C840-044E-11D1-B3E9-00805F499D93"
id="detectPlugi nApplet"
data="Detector. class"
type="applicati on/x-java-applet"
codebase="."
width = "1"
height = "1"
align = "middle"
vspace = "0"
hspace = "0"
>
<param name = "code" value = "Detector"/>
<param name = "codebase" value = ".">
<param name = "mayscript" value ="true"/>
<param name = "scriptable " value = "true">
<param name = "progressba r" value="true" />
<param name = "boxmessage " value="Laster detektor applet"/>
</object>
</body>

--
Dag.
Oct 26 '06 #4
ao****@hotmail. com wrote:
Thanks!

But I tried this, getting the java plugin always results in an error!
(making the javaVersion == null)....
Ah... Sorry about that... Hadn't tested it myself

It should work in IE (As long as you fixed my typos
and missing string terminators, et.c).

But the object tag won't work properly across browsers,
so replace the html-body i gave you with this instead:

<body onload="checkPl ugIn();">
<applet
id="detectPlugi nApplet"
code="Detector. class"
width = "1"
height = "1"
align = "middle"
vspace = "0"
hspace = "0"
>
</applet>
</body>

and it should work. The "Detector.class " file must of course
be in the same directory as the html-file.

I have now actually tested what I gave you ;-) And it works ok
in IE6.0, FF 2.0 and Opera 9.0...

--
Dag.
Oct 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5758
by: Chris | last post by:
I want to detect the version of the JVM that is being used by the browser, for both IE & Firefox (and maybe also Opera & Safari if possilbe). I have searched around the web for such a program, however it seems that all I can find is people that have done it by means of a Java appplet. This is all very well, but it doesn't help me because I want to return the result (version & Supplier) to the browser to fill in a webform. I would prefer...
1
2326
by: Jan Vinten | last post by:
Hello, I'm looking for a javascript, that can detect which java VM is installed and what the current version is. Can any of you give me some details? Best regards, Jan Denmark
2
10035
by: Yurij Nykon | last post by:
Hi all. How can I detect the version of Flash-Plugin installed in Internet Explorer? In Netscape i can do this with following java script navigator.plugins.description But it doesn't works in IE? Can anyone help me? Thanx in advance,
1
2841
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and so on with Request.Browser.Cookies). I saw some server controls that register a startup script on the page_load and then perform a postback and run the javascript,changing a hidden
3
6311
by: zZ | last post by:
Hi All, I need to detect the framework installed from both VB.Net and VB6. Can someone give me an hint? Thanks for any tip. Kind regards, Zen
1
2880
by: Kevin | last post by:
Hi! There is a way to detect which office version have a Windows? Thanks
2
2206
by: Saber | last post by:
To detect if .net framework is installed or not on client's computer, and if yes, what is its version, I found an article: http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;315291 But it can be done in a Setup and Deployment project, my program doesn't needs setup and deployment, it runs just on CD-ROM and for simplicity I don't want to add Setup, Shortcuts, etc. I want after inserting CD-ROM that contains my program, appear a...
6
1973
by: Fred Hedges | last post by:
Using .NET 1.1, I need to be able to detect if Themes are enabled or disabled, not for a specific application, but for the system as a whole (ie. the current user). The reason I need to be able to do this is because of this bug in MFC http://support.microsoft.com/?kbid=319740, which is used to build a component I am in turn making use of. So, I need to detect if Themes are running and if so, see if the correct version of uxtheme.dll is...
2
2222
by: Yisehaq | last post by:
hello Everyone I am working on a CD which contains data to be explored usingOLAP tools. (Pivot tables) I have made it an autorun and the pages comes and using pivot tables component one can explore the data on it. My problem is if office or OWC is not installed on the PC it creates errors. Now, I want to detect where Pivot table or OWC is installed in advance and if not send a message to the user to intall it. I will put in one folder the...
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.