http://www.mail-archive.com/[EMAIL PROTECTED]/msg06237.html
Did anyone get cfscript code relying on the AWT Toolkit working on Linux? I kept getting a NoClassDefFoundError when creating an instance of the toolkit using the getDefaultToolkit() method. Also tried the Swing ImageIcon class and had the same problem. The only code I could get to work reliably on Linux used the ImageIO class which is only available in JRE 1.4+, resulting in the following code block...
<cfscript>
// get Java version
oSystem = createObject("java", "java.lang.System");
javaVersion = oSystem.getProperty("java.version");
osName = oSystem.getProperty("os.name");if ( left(trim(javaVersion),3) gte 1.4 ) {
oImageIO = createObject("java", "javax.imageio.ImageIO");
oFile = createObject("java", "java.io.File");
oFile.init("#filePath#");
oImage = oImageIO.read(oFile);
if ( oImage.getWidth() neq -1 and oImage.getHeight() neq -1 ) {
imageInfo.width = oImage.getWidth();
imageInfo.height = oImage.getHeight();
}
} else if ( findNoCase("windows",osName) ) {
// only use the AWT toolkit on Windows, doesn't always work on *nix
oAWTToolkit = createObject("java", "java.awt.Toolkit");
oToolkit = oAWTToolkit.getDefaultToolkit();
oImage = oToolkit.getImage("#filePath#");
if ( oImage.getWidth() neq -1 and oImage.getHeight() neq -1 ) {
imageInfo.width = oImage.getWidth();
imageInfo.height = oImage.getHeight();
}
}
</cfscript>Should give you some help (and can manipulate java from there)
Paul
--
These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*To unsubscribe, e-mail: [EMAIL PROTECTED]
