[H-GEN] Help with Java...

James McPherson - PTS Engineer James.McPherson at Sun.COM
Sun Dec 7 22:37:25 EST 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Brad Apps wrote:
> We have made an application in Cold Fusion which calls this function:
> 
> function getImageDimensions(sFile) {
> var strRtn = structNew();
> var oImage = createObject("java","javax.swing.ImageIcon").init(sFile); *
> strRtn.width = oImage.getIconWidth();
> strRtn.height = oImage.getIconHeight();
> 
> It measures the height and width of the image, it uses a java function 
> called ImageIcon, I believe this to be included in the standard java 
> library which we have installed.  This works fine on a windows system 
> with a standard Cold Fusion installation and no extra java stuff 
> installed.  Our production box however is a Red Hat 7.3 system with std. 
> CF, Apache, Tomcat and Java JDK 1.4.  This java function doesn’t work on 
> this box.  It is a headless system which may be causing a problem.  I 
> have found a modification to do to the Cold Fusion java config file 
> which fixes the error but it affects other cold fusion graphics 
> functions which are currently being used.
> 
> The error is:
> 
> Object Instantiation Exception
> 
> May be I need to go outside cold fusion to process this page, any 
> recommendations would be greatly appreciated.


try setting a DISPLAY variable before you run the app. One thing you
might also want to check is that you have a graphics context to create
the imageicon in. To do this you should check java.sun.com and search
for "graphics context gc swing 1.4" -- should give you what you need.


James C. McPherson
--
Pacrim PTS Engineer            828 Pacific Highway
                                Gordon NSW
Sun Microsystems Australia     2072



_______________________________________________
General mailing list
General at lists.humbug.org.au
http://lists.humbug.org.au/cgi-bin/mailman/listinfo/general



More information about the General mailing list