Sankalpa Wijewickrama
Sankalpa Wijewickrama

Reputation: 1275

I can't import `java.time` package

I want to develop a time slot where there are small time periods in that main time slot. I can't import java.time package and it says that package does not exist.

I have jdk1.8.0_111 and from NetBeans -> Tools -> Java Platforms, I have added. I still can't import the package correctly. Please help me to import this package and continue.

enter image description here

Upvotes: 2

Views: 5453

Answers (1)

Basil Bourque
Basil Bourque

Reputation: 339422

Java 8 and later

The java.time classes are built into Java 8 and later. Be sure to:

  • Install Java 8 or later
  • Configure your IDE to use Java 8 or later
  • Configure your build process to use Java 8 or later.

Note that Java 9 fixes a few bugs and adds a few enhancements to the java.time classes over that of Java 8. So when Java 9 ships, revisit all three of those bullets above.

Java SE 6 and SE 7

Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport. Add this library to your project.

Android

The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.

See How to use ThreeTenABP….

Upvotes: 1

Related Questions