|
Hi Leif,Thanks. I'm no Java programmer, but that looks a lot like what Scott K has in his service program, although with some error handling. I don't know that it's any easier or better a solution than the simple strdbg/enddbg though. And it doesn't really explain what the problem is; it's just another way around it.
I have noticed that if I don't do the strdbg/enddbg, but simply call the program again after the error has occurred, it works fine. Which makes it sound like something in the JVM gets initialized after the first call, so that it works the 2nd time.
*Peter Dow* / Dow Software Services, Inc. 909 793-9050 pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> / Leif Guldbrand wrote:
Sorry Peter, Seem the link I gave you goes to nowhere..... Here's the hole thing in text (thanks to Marco): Hey all,Just thought I'd let you know that I was able to work my way around this problem...thanks to David Hinselwood...I saw that he'd had a similar problem back in the day and contacted him to see if he had ever resolved it...he said that he created his own java program to open the spreadsheet instead of having RPG do it...here's his java program:XLWorkBook.java import java.io.*; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class XLWorkBook { static public HSSFWorkbook loadWB(String fileName) { POIFSFileSystem fs = null; HSSFWorkbook wb = null; FileInputStream infile = null; try { infile = new FileInputStream(fileName); fs = new POIFSFileSystem(infile); wb = new HSSFWorkbook(fs); infile.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (infile != null) { try { infile.close(); } catch (IOException e) { e.printStackTrace(); } } } return wb; } }place this java program in the same IFS folder as the Jakarta POI jar files...change your current directory on the iSeries using CHGCURDIR DIR('/QIBM/UserData/Java400/ext/')...or wherever your POI files are...then compile the java program using STRQSH...in there execute the following command...javac /QIBM/UserData/Java400/ext/XLWorkBook.java...this will create your class for use in your RPGLE programs...then, in my RPGLE program: d openXL pr o extproc(*JAVA d :'XLWorkBook' d :'loadWB') d CLASS(*JAVA: d 'org.apache.poi.hssf.usermodel- d .HSSFWorkbook') d static d fileName like(jString) ... d fileName s like(jString) ... fileName = new_String('/home/scessna/excel/May05DailyLaborHours.xls'); book = openXL(fileName); hope this helps anyone else who was/is having the same problem as me...Leif
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.