1

I've tried to build a calendar with ical4j. When I'm trying to get the output to a file, it's giving me an exception like given below :

net.fortuna.ical4j.validate.ValidationException: Property [PRODID] must be specified once.

The code :

FileOutputStream icsOutputStream = new FileOutputStream(new File("").getAbsoluteFile()+ "classInfo.ics");
CalendarOutputter icsOutputter = new CalendarOutputter();
icsOutputter.output(ical4jHandler.icsCalender,icsOutputStream);
Anish B.
  • 9,111
  • 3
  • 21
  • 41

1 Answers1

0

From the ical4j documentation, you can try this :

import net.fortuna.ical4j.model.Calendar;

// add this :
// create a new calendar
Calendar cal = new Calendar();
cal.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
cal.getProperties().add(Version.VERSION_2_0);
// set other properties by looking at the documentation..

// your code 
FileOutputStream icsOutputStream = new FileOutputStream(new File("").getAbsoluteFile()+ "classInfo.ics");
CalendarOutputter icsOutputter = new CalendarOutputter();
// send the cal reference directly.
icsOutputter.output(cal,icsOutputStream);

Plz refer to the docs for more info.

Anish B.
  • 9,111
  • 3
  • 21
  • 41