2

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

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Sankalpa Wijewickrama
  • 985
  • 3
  • 19
  • 30

1 Answers1

1

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….

Community
  • 1
  • 1
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154