Shaun Mccran

My digital playground

30
J
A
N
2011

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")>
2
3<cfdump
4var="#systemObj.getProperties()#"
5label="Java system values"
6expand="false">

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:

http://www.mccran.co.uk/examples/java_version/

Related Blog Entries

TweetBacks
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/2011 23:08
Back to top