I have a totally newb problem. I have a written a java class to unzip files
(which works JRUN's jre), but I am trying to use it with coldfusion and am
unable to get coldfusion to even recognize that it is there. I have set up the
classpath in administrator and ensured several times that the path is correct.
The contents of the classpath field in CFAdmin is:
C:\CFusionMX7\runtime\jre\lib\YP_Unzip.class
I am sure I have to have something configured incorrectly.
here is my code (though I am not sure that this is the problem):
COLDFUSION:
<cfset temp = createObject("java", "YP_Unzip")>
JAVA:
import java.io.*;
import java.util.zip.*;
class YP_UnZip {
public void Unzip (String Args[]){
int BUFFER = 2048;
int i;
BufferedOutputStream dest = null;
FileInputStream inputfile;
ZipInputStream zipfile;
if (Args.length != 0){
//loop over files to be unzipped
for(i=0; i <Args.length; i++){
System.out.print("Unzipping : ");
System.out.print(Args[i]);
System.out.println();
try{
inputfile = new FileInputStream(Args[i]);
zipfile = new ZipInputStream(new
BufferedInputStream(inputfile));
ZipEntry entry;
while ((entry = zipfile.getNextEntry()) != null){
System.out.println("Extracting : "+entry);
int count;
byte data[] = new byte[BUFFER];
//write the back to disk
FileOutputStream outputfile = new
FileOutputStream(entry.getName());
dest = new BufferedOutputStream(outputfile, BUFFER);
while ((count = zipfile.read(data, 0, BUFFER)) != -1) {
dest.write(data, 0, count);
}
dest.flush();
dest.close();
}
}
catch(Exception e){
e.printStackTrace();
}//end try-catch block
} //end for loop
}//end if (Args.length != 0)
else{
//code for error handling goes here - error missing file
}
}//main
}
Any help would be greatly appreciated.
Thanks,
Wes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275762
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4