0

I'm using eclipse photon with jdk 11, i tried the declaration of a JDateChooser but it couldn't be resolved to a type althought i imported everything in need

any idea on how i can make it work

  • Could you please post the code? – GBlodgett Dec 31 '18 at 16:36
  • i just tried JDateChooser jdc = new JDateChooser(); which gives the error of not being resolved as a type – Net Monster Dec 31 '18 at 17:03
  • 2
    No, [edit] your question, and add the code, including the imports. You can remove all the irrelevant parts. Leave only a minimal piece of code which should compile but doesn't. Also make sure the applicable jars are in the build path. – RealSkeptic Dec 31 '18 at 17:39
  • There is no JDateChooser class in [JDK11](https://docs.oracle.com/en/java/javase/11/docs/api/allclasses.html), so you have to import an external jar (maybe [this](https://github.com/vadimig/jdatechooser)) in order to use it. Please edit your question pasting your code and be sure to paste the `import` too. – RubenDG Dec 31 '18 at 18:42

2 Answers2

0

You can use the toString() method to store the jDateChooser value into a string variable.

For example:

String dob = jDateChooser1.getDate().toString();
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Rakhi jha
  • 21
  • 2
0

This error occurs because the JDateChooser class is not recognized by the compiler. It means that the required library or dependency for JDateChooser is missing or not properly imported.

To fix this error, you need to make sure that you have the necessary library or dependency for JDateChooser added to your project. This can be done by either downloading the JDateChooser library and adding it to your project’s classpath, or by using a build tool like Maven or Gradle to manage your dependencies.

Download the JDateChooser library and add it to your project’s classpath. Import the JDateChooser class in your code: import com.toedter.calendar.JDateChooser; Now you should be able to use the JDateChooser class in your code without any errors.

  • Wow. Nice find. But it could be made even better by posting an example of `pom.xml` or `build.gradle` file that shows how to download that dependency with the correct version. Also you should edit your answer with a small guide on how to add the library to the project's classpath. – sanitizedUser Jul 10 '23 at 08:35
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 10 '23 at 08:35