Shaun Mccran

My digital playground


Using ColdFusion to see Java server values

I've been dabbling in more and more Java recently as an accompaniment to my using ColdFusion development, and I've been finding more and more places where they support each other.

I rolled out a new Application to a live server (this one) and it failed to launch. This was all down to it running an incompatible JVM. So how do you tell what JVM version your server is running? I don't have direct access to this box, so I needed to do it in code.

We are going to use ColdFusion to create a java 'system' object and call the getProperties method on it. This is using the standard CreateObject ColdFusion code.

view plain print about
1<cfset systemObj = CreateObject("java", "java.lang.System")>
5label="Java system values"

Just dump the whole returned Structure object out and you have all the server side Java environment values.

The one I was specifically looking for was the 'java.vm.version', which accurately reported that it was too low to run my newly compiled Application.

You can see an example of the code running here:

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Mike Collins's Gravatar I have used this in the past. You can also setProperty too, which is a cool way to introduce a global switch, for logging, debugging etc.
# Posted By Mike Collins | 31/01/11 23:08
Back to top