我想使用ical4j来向用户发送事件。
当我执行此代码时:
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true);
// Create a TimeZone
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timezone = registry.getTimeZone("Europe/Paris");
VTimeZone tz = timezone.getVTimeZone();
我得到这个错误;
Exception in thread "main" java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/ConcurrentHashMap
at net.fortuna.ical4j.util.CompatibilityHints.<clinit>(CompatibilityHints.java:85)
at net.fortuna.ical4j.model.Iso8601.<init>(Iso8601.java:78)
at net.fortuna.ical4j.model.Date.<init>(Date.java:133)
at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:244)
at jconge_batches.TestCalendar.main(TestCalendar.java:106)
Caused by: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap
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)
... 5 more
我在我的类路径中添加了ical4j.jar。
如何解决此错误?
最佳答案
Here是ica4j 1.x所需的库:
backport-util-concurrent.jar
commons-codec.jar
commons-io.jar
commons-lang.jar
commons-logging.jar
junit.jar
commons-io和junit仅在单元测试中需要。