P.Applet main issue - Processing and Eclipse
in
Integration and Hardware
•
2 years ago
Hi All
I wonder if any one can help me with a problem?
I am using Eclipse, set up without the plug-in, just having the core.jar and other files in the build path as needed.
I was hoping to use a CSV parsing library, and have been exploring an example of how to use it and integrate into my project. All was going well until I wanted to modify the main public static void main(String[] args) method which has the line PApplet.main(new String[] { "BidsData" }); within it.
I wanted to have the following, which uses the format of the SuperCSV example found here http://supercsv.sourceforge.net/codeExamples_general.html
The problem is the use of the term Exception, to catch files that might not be there...
This use of Exception does not compile- and the cause is that I have the line needed to work with Processing in Eclipse
If I take that 'extends PApplet' component out of that line, Eclipse permits the use of Exception- but then of course, I am not now working with the Processing core.
What might I do to keep the CSV file loading within this first method?
I have tried other forms of Exception, such as FileNotFoundException, to no avail?
Many thanks!
sacculi
I wonder if any one can help me with a problem?
I am using Eclipse, set up without the plug-in, just having the core.jar and other files in the build path as needed.
I was hoping to use a CSV parsing library, and have been exploring an example of how to use it and integrate into my project. All was going well until I wanted to modify the main public static void main(String[] args) method which has the line PApplet.main(new String[] { "BidsData" }); within it.
I wanted to have the following, which uses the format of the SuperCSV example found here http://supercsv.sourceforge.net/codeExamples_general.html
The problem is the use of the term Exception, to catch files that might not be there...
- public static void main(String[] args) throws Exception{
PApplet.main(new String[] { "BidsData" });
ICsvBeanReader inFile = new CsvBeanReader(new FileReader("people.csv"), CsvPreference.EXCEL_PREFERENCE);
try {
final String[] header = inFile.getCSVHeader(true);
UserBean user;
while( (user = inFile.read(UserBean.class, header, userProcessors)) != null) {
System.out.println(user.getZip());
}
} finally {
inFile.close();
}
}
This use of Exception does not compile- and the cause is that I have the line needed to work with Processing in Eclipse
- public class BidsData extends PApplet
If I take that 'extends PApplet' component out of that line, Eclipse permits the use of Exception- but then of course, I am not now working with the Processing core.
What might I do to keep the CSV file loading within this first method?
I have tried other forms of Exception, such as FileNotFoundException, to no avail?
Many thanks!
sacculi
1