要求能检测几乎所有的版本,应该如何检测阿
解决方案 »
- 这两程序的结果为何不一样??
- 为什么我的java程序连接sql server 2005时却连不上,总是报错,
- Java提供了两类主要的异常
- 如何让在一个线程内DAO对象在一个时刻内只被调用一次?
- 在JTree中添加一个结点
- 哪有Eclipse教程或使用指导?
- 配置了JDK7的环境变量为什么javac命令不行
- 谁能给一段解微分的程序(初学者求救)
- 请问怎样把ResultSet保存到数组中?
- 各位大虾,我现在再用SA(System Architect)做项目设计,有谁知道怎样用SA将Java源代码倒成类图?
- 使用org.apache.commons.net.ftp的Ftp类取文件时,文件名前面多了一个空格,不知道哪位知道为何?
- 简单问题求教。
System.out.print(System.getProperty("java.version"));
}
java程序运行应该都需要JVM吧...??如果没有JVM,这个检测的程序如何执行?也就是说,只有可能返回版本,怎么可能返回:"无"???
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/launch.html
-----------------------------------------------------------------------------
Detecting if Java Web Start is installed on Netscape
Here is the first script that should be run on a web page for launching an application via JNLP:<SCRIPT LANGUAGE="JavaScript"> var javawsInstalled = 0;
var javaws142Installed=0;var javaws150Installed=0;isIE = "false"; if (navigator.mimeTypes && navigator.mimeTypes.length) { x = navigator.mimeTypes['application/x-java-jnlp-file']; if (x) {
javawsInstalled = 1; javaws142Installed=1;
javaws150Installed=1; } } else { isIE = "true"; } </SCRIPT>
This script looks at the navigator.mimeTypes object and the navigator.mimeTypes.length var to decide if the browser is Netscape or IE. If length is 0, it is assumed the browser is IE, as with IE the navigator.mimeTypes array is defined but always empty. If length is non-zero, then the browser is assumed to be Netscape and the JNLP MIME type is checked to see if it exists on Netscape. If so, javawsInstalled, javaws142Installed, and javaws150Installed are all set to 1. With Netscape it is not possible to determine which particular version of Java Web Start is installed, so all four variables are set to 1.Detecting if JavaWeb Start is installed on IE, and if so, the version
The above JavaScript should be followed by a VBScript that sets variables related to Internet Explorer browers: <SCRIPT LANGUAGE="VBScript">
on error resume next
If isIE = "true" Then
If Not(IsObject(CreateObject("JavaWebStart.isInstalled"))) Then
javawsInstalled = 0
Else
javawsInstalled = 1
End If
If Not(IsObject(CreateObject("JavaWebStart.isInstalled.1.4.2.0"))) Then
javaws142Installed = 0
Else
javaws142Installed = 1
End If
If Not(IsObject(CreateObject("JavaWebStart.isInstalled.1.5.0.0"))) Then
javaws150Installed = 0
Else
javaws150Installed = 1
End If
End If
</SCRIPT>This VBScript is executed if the variable isIE from the preceeding JavaScript is "true"; i.e., if the end-user's browser is Internet Explorer. This script instantiates the isInstalled COM object in JavaWebStart.dll, and this object determines four things