Saturday, September 07, 2002

Wondering about your java configuration running under CFMX?

If you've wondered about various settings of the Java environment configuration you've got running under CFMX--such as what the classpath is, what version of the JVM is running, you can easily see that using the CF Administrator. No, I don't mean by going to the "Java and JVM" settings page. That's where you can modify these things. I mean the "version information" link that's at the top of the administrator.

There's a wealth of info there, about both the Java and CF environments (such as CF Version and license info). Of course, the JVM info there is info you can get from the JVM itself if you know how to do so, but it's nice to know you don't have to.

And though you may think that the "Java and JVM" settings page in the admin tells the same thing about the JVM and the classpath, well, first there's a lot more on this "version" page than just that. Second, the "Java and JVM" page may show the location of the JVM, but it doesn't tell you what version of the JVM it is. Finally, though it lets you enter info in the "class path" field, what you may not realize is that there is already info in the classpath even before you enter a value there.

What if you don't have access to the CF Administrator? Again, if you know how to, you can find some of the JVM info on the command line in that the JVM's directory (using "Java -version" for instance).

But you can also find things out if you know how to use the Java system library API. If that sounds foreign, don't worry. Just save the following script as getversion.cfm in a web directory of CFMX and run it:

<cfset sys = createObject("Java", "Java.lang.System")>
JVM name: #sys.getproperty("")#<br>
JVM version (build): #sys.getproperty("Java.version")# (#sys.getproperty("Java.vm.version")#)<br>
JVM class path: #sys.getproperty("Java.class.path")#<br>

When I ran this on my machine, I was surprised to see that CFMX's built-in JVM is running the HotSpot compiler. That's good to see.

And the classpath had much more than just what I may have entered in the JVM Path in the administrator (actually, this is not new. CF 4.5 and 5 did that as well.)

No comments: