Referencing Java Installation Path from ASP

Referencing Java Installation Path from ASP

am 15.04.2007 23:07:04 von Brad Baker

Our developers are calling a java application from an ASP/ASP.net page.
Excerpt as follows:

----
Dim a_jvmargs(1)
a_jvmargs(0)= "-Djava.class.path=C:\Program
Files\Java\j2re1.4.2_04\lib\rt.jar;" &_
"C:\jar1.jar;" &_
"C:\jar2.jar;" &_
"C:\jar3.jar;" &_
"C:\jar4.jar"

set objJVM = Server.CreateObject("comJava.comJavaJvm")

objJVM.setVMArguments(a_jvmargs)
objJVM.setJavaVMLibraryPath("C:\Program
Files\Java\j2re1.4.2_04\bin\client\jvm.dll")
objJVM.CreateJavaVM()
----

Note the hard coded references to the java installation directory. I.E.
(C:\program files\Java\jre1.4.2_04)

Unfortunately hard coding the path to java isn't the most ideal solution for
various reasons. Primarily upgrading java on our servers without breaking
our app is problematic. Likewise it requires deploying old versions of java
to new servers to retain compatibility. (For refernce purposes this code is
being used by hundreds of websites across dozens of servers)

So my question is - is there any way to dynamically reference the latest
java installation directory from ASP vs hard coding it?

Thanks
Brad