简体   繁体   中英

Error when using ical4j.jar Java

I want to use ical4j in order to send event to users. When I execute this code :

    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();

I getting this error ;

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

I have added ical4j.jar in my classpath.

How I can resolve this error?

Here are the libraries you need for ica4j 1.x:

  • backport-util-concurrent.jar
  • commons-codec.jar
  • commons-io.jar
  • commons-lang.jar
  • commons-logging.jar
  • junit.jar

commons-io and junit only required for unit testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM