我想讀一個項目的iCalendar(ics文件),並認爲它可能更容易使用一個API。經過很多研究,我發現iCal4j。沒有找到類LoggerFactory
我是ical4j的新手,一直在尋找答案,並試圖做研究,發現它的創造者允許任何形式的伐木他們想要的,所以我真的很困惑。我試圖找到一個我發現工作的簡單例子。我對不同的API很恐怖,它會殺死我。我只是有iCal4j-2.0-beta1.jar在我的類路徑中,我有以下代碼:
import java.io.*;
import net.fortuna.ical4j.data.*;
import net.fortuna.ical4j.model.*;
public class iCalendarSupport
{
public static void main(String[] args)
{
try
{
FileInputStream fin = new FileInputStream("C:\\Users\\Mike\\Downloads\\basic (1).ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(fin);
System.out.println(calendar.getComponent("Event").toString());
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
下面是在Eclipse的控制檯輸出我有。
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at net.fortuna.ical4j.util.Configurator.<clinit>(Configurator.java:51)
at net.fortuna.ical4j.data.CalendarParserFactory.<clinit>(CalendarParserFactory.java:63)
at net.fortuna.ical4j.data.CalendarBuilder.<init>(CalendarBuilder.java:104)
at iCalendarSupport.main(iCalendarSupport.java:12)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
任何幫助將不勝感激。
我也正在使用本教程開始。 (這是我能找到的最直接的方式[鏈接](https://github.com/ical4j/ical4j/wiki/Tutorial) – Syrrus