While working with the java.lang.System class today, I stumbled across two properties that appear to reveal that information. Now you may already be familiar with this. But I myself am still slightly incredulous I never noticed it before.
Note, property names are case sensitive!
<!--- cfSearching: display the CF classpath and user account name --->
<cfset sys = createObject("java", "java.lang.System")>
<!--- cfSearching: display the CF classpath and user account name --->
<cfoutput>
<b>user.name</b> = #sys.getProperty("user.name", "not found")#<hr>
<b>coldfusion.classPath</b> = #sys.getProperty("coldfusion.classPath")#<br>
</cfoutput>
To display all System properties
<!--- cfSearching: show all properties --->
<cfset prop = createObject("java", "java.lang.System").getProperties()>
<cfdump var="#prop#">
This one will definitely be added to my utility library.
Sweet!... Very useful. I can run this against my hosting account and know exactly how i'm setup.
ReplyDeleteCheers
The Job Fool