• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

POI-HSSF problem. saves in /runtime/bin, not /wwwroot

Explorer ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

I am trying to get this to work in Solaris/Apache/MX7. When I run the code, it always saves the files in

<cfusionserver>/runtime/bin/
with owner "nobody|other"

i need the files to read and write from
<cfusionserver>/wwwroot/
owner "www|www"

any suggestions?

files located in <cfserver>/WEB-INF/lib/

-rw-r--r-- 1 www www 802216 May 16 09:42 poi-2.5.1-final-20040804.jar
-rw-r--r-- 1 www www 55209 May 16 09:42 poi-contrib-2.5.1-final-20040804.jar


<CFSCRIPT>
workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init();
newSheet=workBook.createSheet();
workBook.setSheetName(0, "My First Sheet");
row=newSheet.createRow(55);
cell=row.createCell(0);
cell.setCellValue("hello world!");
fileOutStream = createObject("java","java.io.FileOutputStream").init("test6.xls"); // ****** output
workBook.write(fileOutStream);
fileOutStream.close();
</CFSCRIPT>
I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i get an error.

Thanks if you can help
Dave

TOPICS
Advanced techniques

Views

332

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

what error do you get when trying the init("/opt....")?

that's on the right track...just using the filename itself is definitely not
what you want.

what you might do to get the full path you're looking for is create a file
in wwwroot and do a
<cfoutput>#getDirectoryFromPath(getCurrentTemplatePath())#</cfoutput>

that'll tell you what coldfusion thinks it is, and from there you should
have what you need to pass into the file init


"DaveF67" <webforumsuser@macromedia.com> wrote in message
news:e4d0n6$6vh$1@forums.macromedia.com...
>I am trying to get this to work in Solaris/Apache/MX7. When I run the code,
>it
> always saves the files in
>
> <cfusionserver>/runtime/bin/
> with owner "nobody|other"
>
> i need the files to read and write from
> <cfusionserver>/wwwroot/
> owner "www|www"
>
> any suggestions?
>
> files located in <cfserver>/WEB-INF/lib/
>
> -rw-r--r-- 1 www www 802216 May 16 09:42
> poi-2.5.1-final-20040804.jar
> -rw-r--r-- 1 www www 55209 May 16 09:42
> poi-contrib-2.5.1-final-20040804.jar
>
>
> <CFSCRIPT>
>
> workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init
> ();
> newSheet=workBook.createSheet();
> workBook.setSheetName(0, "My First Sheet");
> row=newSheet.createRow(55);
> cell=row.createCell(0);
> cell.setCellValue("hello world!");
> fileOutStream =
> createObject("java","java.io.FileOutputStream").init("test6.xls"); //
> ******
> output
> workBook.write(fileOutStream);
> fileOutStream.close();
> </CFSCRIPT>
> I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i
> get an
> error.
>
> Thanks if you can help
> Dave
>
>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

LATEST
also, you might try creating a file object first, initing that with your
full path, and then passing that object into the init method of the output
stream

"Marc E" <cf@hifiwebdesign.com> wrote in message
news:e4dlop$3t4$1@forums.macromedia.com...
> what error do you get when trying the init("/opt....")?
>
> that's on the right track...just using the filename itself is definitely
> not what you want.
>
> what you might do to get the full path you're looking for is create a file
> in wwwroot and do a
> <cfoutput>#getDirectoryFromPath(getCurrentTemplatePath())#</cfoutput>
>
> that'll tell you what coldfusion thinks it is, and from there you should
> have what you need to pass into the file init
>
>
> "DaveF67" <webforumsuser@macromedia.com> wrote in message
> news:e4d0n6$6vh$1@forums.macromedia.com...
>>I am trying to get this to work in Solaris/Apache/MX7. When I run the
>>code, it
>> always saves the files in
>>
>> <cfusionserver>/runtime/bin/
>> with owner "nobody|other"
>>
>> i need the files to read and write from
>> <cfusionserver>/wwwroot/
>> owner "www|www"
>>
>> any suggestions?
>>
>> files located in <cfserver>/WEB-INF/lib/
>>
>> -rw-r--r-- 1 www www 802216 May 16 09:42
>> poi-2.5.1-final-20040804.jar
>> -rw-r--r-- 1 www www 55209 May 16 09:42
>> poi-contrib-2.5.1-final-20040804.jar
>>
>>
>> <CFSCRIPT>
>>
>> workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init
>> ();
>> newSheet=workBook.createSheet();
>> workBook.setSheetName(0, "My First Sheet");
>> row=newSheet.createRow(55);
>> cell=row.createCell(0);
>> cell.setCellValue("hello world!");
>> fileOutStream =
>> createObject("java","java.io.FileOutputStream").init("test6.xls"); //
>> ******
>> output
>> workBook.write(fileOutStream);
>> fileOutStream.close();
>> </CFSCRIPT>
>> I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i
>> get an
>> error.
>>
>> Thanks if you can help
>> Dave
>>
>>
>>
>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation