Eclipse error … cannot be resolved to a type





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







47















I have a dynamic web project that I am working on to migrate a jsp/servlet app from JRun to Tomcat.



I am getting the error: com.ibm.ivj.eab.dab.DatastoreJDBC cannot be resolved to a type.



I have the *.class files sitting inside a com/ibm/ivj/eab/dab folder (exactly how I found them). I have tried creating a jar file and adding that to the build path via "Add External Jar", I have also tried adding an "External Class Folder" and pointing to the folder that contains the "com" directory in question.



Still, the error persists. What is strange is if I start typing the package name eclipse actually auto-completes the class for me! (pictured below). Any ideas would be greatly appreciated. Maybe the classes were compiled for a much older java version and that is causing trouble? Maybe there is something I need to do to ensure the classes end up in the WEB-INF/lib directory?



Ienter image description here










share|improve this question























  • Is there an import statement in your code for the class?

    – Chris Gerken
    Apr 3 '13 at 18:22











  • @ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

    – mikey
    Apr 3 '13 at 18:27


















47















I have a dynamic web project that I am working on to migrate a jsp/servlet app from JRun to Tomcat.



I am getting the error: com.ibm.ivj.eab.dab.DatastoreJDBC cannot be resolved to a type.



I have the *.class files sitting inside a com/ibm/ivj/eab/dab folder (exactly how I found them). I have tried creating a jar file and adding that to the build path via "Add External Jar", I have also tried adding an "External Class Folder" and pointing to the folder that contains the "com" directory in question.



Still, the error persists. What is strange is if I start typing the package name eclipse actually auto-completes the class for me! (pictured below). Any ideas would be greatly appreciated. Maybe the classes were compiled for a much older java version and that is causing trouble? Maybe there is something I need to do to ensure the classes end up in the WEB-INF/lib directory?



Ienter image description here










share|improve this question























  • Is there an import statement in your code for the class?

    – Chris Gerken
    Apr 3 '13 at 18:22











  • @ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

    – mikey
    Apr 3 '13 at 18:27














47












47








47


7






I have a dynamic web project that I am working on to migrate a jsp/servlet app from JRun to Tomcat.



I am getting the error: com.ibm.ivj.eab.dab.DatastoreJDBC cannot be resolved to a type.



I have the *.class files sitting inside a com/ibm/ivj/eab/dab folder (exactly how I found them). I have tried creating a jar file and adding that to the build path via "Add External Jar", I have also tried adding an "External Class Folder" and pointing to the folder that contains the "com" directory in question.



Still, the error persists. What is strange is if I start typing the package name eclipse actually auto-completes the class for me! (pictured below). Any ideas would be greatly appreciated. Maybe the classes were compiled for a much older java version and that is causing trouble? Maybe there is something I need to do to ensure the classes end up in the WEB-INF/lib directory?



Ienter image description here










share|improve this question














I have a dynamic web project that I am working on to migrate a jsp/servlet app from JRun to Tomcat.



I am getting the error: com.ibm.ivj.eab.dab.DatastoreJDBC cannot be resolved to a type.



I have the *.class files sitting inside a com/ibm/ivj/eab/dab folder (exactly how I found them). I have tried creating a jar file and adding that to the build path via "Add External Jar", I have also tried adding an "External Class Folder" and pointing to the folder that contains the "com" directory in question.



Still, the error persists. What is strange is if I start typing the package name eclipse actually auto-completes the class for me! (pictured below). Any ideas would be greatly appreciated. Maybe the classes were compiled for a much older java version and that is causing trouble? Maybe there is something I need to do to ensure the classes end up in the WEB-INF/lib directory?



Ienter image description here







java eclipse






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 '13 at 18:10









mikeymikey

4,04521727




4,04521727













  • Is there an import statement in your code for the class?

    – Chris Gerken
    Apr 3 '13 at 18:22











  • @ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

    – mikey
    Apr 3 '13 at 18:27



















  • Is there an import statement in your code for the class?

    – Chris Gerken
    Apr 3 '13 at 18:22











  • @ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

    – mikey
    Apr 3 '13 at 18:27

















Is there an import statement in your code for the class?

– Chris Gerken
Apr 3 '13 at 18:22





Is there an import statement in your code for the class?

– Chris Gerken
Apr 3 '13 at 18:22













@ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

– mikey
Apr 3 '13 at 18:27





@ChrisGerken no I did just add <%@page import="com.ibm.ivj.eab.dab.*"%> to the top (this is a JSP page) and also <%@page import="com.ibm.ivj.eab.dab.DatastoreJDBC"%> what is interesting is Eclipse doesn't mind the first import but marks the second as an error.

– mikey
Apr 3 '13 at 18:27












15 Answers
15






active

oldest

votes


















40















  1. Right click your project name.


  2. Click Properties.


  3. Click Java Build Path.


  4. Click on Add Class Folder.


  5. Then choose your class.



Alternatively, Add Jars should work although you claim that you attempted that.



Also, "have you tried turning it off and back on again"? (Restart Eclipse).






share|improve this answer


























  • When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

    – mikey
    Apr 3 '13 at 18:23











  • Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

    – mikey
    Apr 3 '13 at 19:05






  • 5





    It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

    – mikey
    Apr 5 '13 at 14:44











  • Which class needs to be selected here?

    – Fahad Uddin
    Jun 9 '14 at 21:17






  • 2





    The issue was solved after I restarted Eclipse

    – Zvi
    Mar 13 '17 at 7:21



















40














Also If you are using mavenised project then try to update your project by clicking Alt+F5.
Or right click on the application and go to maven /update project.



It builds all your components and resolves if any import error is there.






share|improve this answer



















  • 4





    Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

    – XMight
    Mar 29 '16 at 8:19






  • 1





    I'd like to echo @XMight 's question.

    – Erutan409
    Mar 17 '17 at 19:25













  • I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

    – milijan
    Dec 22 '17 at 11:11



















9














To solve the error "...cannot be resolved to a type.." do the followings:




  1. Right click on the class and select "Build Path-->Exclude"

  2. Again right click on the class and select "Build Path-->Include"


It works for me.






share|improve this answer































    4














    Project -> Clean



    can at least sometimes be sufficient to resolve the matter.






    share|improve this answer































      2














      For maven users:




      • Right click on the project

      • Maven

      • Update Project






      share|improve this answer
























      • For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

        – Curtis Yallop
        Sep 25 '18 at 16:58



















      1















      • Right click Project > Properties


      • Java Build Path > Add Class Folder

      • Select the bin folder

      • Click ok

      • Switch Order and Export tab

      • Select the newly added bin path move UP

      • Click Apply button


      enter image description here






      share|improve this answer































        1














        There are two ways to solve the issue "cannot be resolved to a type
        ":




        1. For non maven project, add jars manually in a folder and add it in java build path. This would solve the compilation errors.

        2. For maven project, right click on the project and go to maven -> update project. Select all the projects where you are getting compilation errors and also check "Force update of snapshots/releases". This will update the project and fix the compilation errors.






        share|improve this answer































          1














          Easy Solution:

          Go to




          Project property -> java builder path -> maven -> find c3p0-0.9.5.2.jar




          and see the location where the file is stored in the local repository and go to this location and delete the repository manually.






          <img src="https://i.stack.imgur.com/dROTl.png" alt="G">








          share|improve this answer

































            0














            Solved the problem by dropping the jar into WEB_INF/lib.






            share|improve this answer































              0














              copying the jar files will resolve. If by any chance you are copying the code from any tutorials, make sure the class names are spelled in correct case...for example i copied a code from one of the tutorials which had solr in S cap. Eclipse was continiously throwing the error and i also did a bit of googling ...everything was ok and it took 30 mins for me to realise the cap small issue. Am sure this will help someone






              share|improve this answer































                0














                For many new users don't forget to add an asterisk (*) after your import statements if you wanna use all the classes in a package....for example



                import java.io.*;

                public class Learning
                {
                public static void main(String args)
                {
                BufferedInputStream sd = new BufferedInputStream(System.in);
                // no error
                }
                }


                ================================================================



                import java.io;

                public class Learning
                {
                public static void main(String args)
                {
                BufferedInputStream sd = new BufferedInputStream(System.in);
                // BufferedInputStream cannot be resolved to a type error
                }
                }





                share|improve this answer































                  0














                  Solution :
                  1.Project -> Build Path -> Configure Build Path



                  2.Select Java Build path on the left menu, and select "Source"



                  3.Under Project select Include(All) and click OK



                  Cause :
                  The issue might because u might have deleted the CLASS files or dependencies on the project






                  share|improve this answer































                    0














                    Project -> Build Path -> Configure Build Path
                    Select Java Build path on the left menu, and select "Source"
                    click on Excluded and then Include(All) and then click OK
                    Cause : The issue might because u might have deleted the CLASS files
                    or dependencies on the project


                    For maven users:



                    Right click on the project



                    Maven



                    Update Project






                    share|improve this answer

































                      0














                      First you need to update the pom.xml by adding below



                          <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-web</artifactId>
                      <version>4.1.6.RELEASE</version>
                      </dependency>


                      1] Right click your project name.



                      2] Click Properties.



                      3] Click Java Build Path.



                      4] Check on 'Maven Dependencies' in Order and Export tabl.



                      In my case, previously it was not enabled. So when I enabled it my @GetMapping annotation works fine..






                      share|improve this answer































                        0














                        Also, there is the solution for IvyDE users. Right click on project -> Ivy -> resolve
                        It's necessary to set ivy.mirror property in build.properties






                        share|improve this answer


























                          Your Answer






                          StackExchange.ifUsing("editor", function () {
                          StackExchange.using("externalEditor", function () {
                          StackExchange.using("snippets", function () {
                          StackExchange.snippets.init();
                          });
                          });
                          }, "code-snippets");

                          StackExchange.ready(function() {
                          var channelOptions = {
                          tags: "".split(" "),
                          id: "1"
                          };
                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                          StackExchange.using("externalEditor", function() {
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled) {
                          StackExchange.using("snippets", function() {
                          createEditor();
                          });
                          }
                          else {
                          createEditor();
                          }
                          });

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: 'answer',
                          autoActivateHeartbeat: false,
                          convertImagesToLinks: true,
                          noModals: true,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: 10,
                          bindNavPrevention: true,
                          postfix: "",
                          imageUploader: {
                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                          allowUrls: true
                          },
                          onDemand: true,
                          discardSelector: ".discard-answer"
                          ,immediatelyShowMarkdownHelp:true
                          });


                          }
                          });














                          draft saved

                          draft discarded


















                          StackExchange.ready(
                          function () {
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15794821%2feclipse-error-cannot-be-resolved-to-a-type%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          15 Answers
                          15






                          active

                          oldest

                          votes








                          15 Answers
                          15






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          40















                          1. Right click your project name.


                          2. Click Properties.


                          3. Click Java Build Path.


                          4. Click on Add Class Folder.


                          5. Then choose your class.



                          Alternatively, Add Jars should work although you claim that you attempted that.



                          Also, "have you tried turning it off and back on again"? (Restart Eclipse).






                          share|improve this answer


























                          • When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                            – mikey
                            Apr 3 '13 at 18:23











                          • Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                            – mikey
                            Apr 3 '13 at 19:05






                          • 5





                            It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                            – mikey
                            Apr 5 '13 at 14:44











                          • Which class needs to be selected here?

                            – Fahad Uddin
                            Jun 9 '14 at 21:17






                          • 2





                            The issue was solved after I restarted Eclipse

                            – Zvi
                            Mar 13 '17 at 7:21
















                          40















                          1. Right click your project name.


                          2. Click Properties.


                          3. Click Java Build Path.


                          4. Click on Add Class Folder.


                          5. Then choose your class.



                          Alternatively, Add Jars should work although you claim that you attempted that.



                          Also, "have you tried turning it off and back on again"? (Restart Eclipse).






                          share|improve this answer


























                          • When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                            – mikey
                            Apr 3 '13 at 18:23











                          • Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                            – mikey
                            Apr 3 '13 at 19:05






                          • 5





                            It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                            – mikey
                            Apr 5 '13 at 14:44











                          • Which class needs to be selected here?

                            – Fahad Uddin
                            Jun 9 '14 at 21:17






                          • 2





                            The issue was solved after I restarted Eclipse

                            – Zvi
                            Mar 13 '17 at 7:21














                          40












                          40








                          40








                          1. Right click your project name.


                          2. Click Properties.


                          3. Click Java Build Path.


                          4. Click on Add Class Folder.


                          5. Then choose your class.



                          Alternatively, Add Jars should work although you claim that you attempted that.



                          Also, "have you tried turning it off and back on again"? (Restart Eclipse).






                          share|improve this answer
















                          1. Right click your project name.


                          2. Click Properties.


                          3. Click Java Build Path.


                          4. Click on Add Class Folder.


                          5. Then choose your class.



                          Alternatively, Add Jars should work although you claim that you attempted that.



                          Also, "have you tried turning it off and back on again"? (Restart Eclipse).







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Sep 18 '18 at 17:18









                          Patrick Haugh

                          31.3k92849




                          31.3k92849










                          answered Apr 3 '13 at 18:16









                          KyleMKyleM

                          2,85873368




                          2,85873368













                          • When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                            – mikey
                            Apr 3 '13 at 18:23











                          • Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                            – mikey
                            Apr 3 '13 at 19:05






                          • 5





                            It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                            – mikey
                            Apr 5 '13 at 14:44











                          • Which class needs to be selected here?

                            – Fahad Uddin
                            Jun 9 '14 at 21:17






                          • 2





                            The issue was solved after I restarted Eclipse

                            – Zvi
                            Mar 13 '17 at 7:21



















                          • When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                            – mikey
                            Apr 3 '13 at 18:23











                          • Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                            – mikey
                            Apr 3 '13 at 19:05






                          • 5





                            It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                            – mikey
                            Apr 5 '13 at 14:44











                          • Which class needs to be selected here?

                            – Fahad Uddin
                            Jun 9 '14 at 21:17






                          • 2





                            The issue was solved after I restarted Eclipse

                            – Zvi
                            Mar 13 '17 at 7:21

















                          When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                          – mikey
                          Apr 3 '13 at 18:23





                          When I "Add Class Folder" should I pick the folder that contains the "com" directory (the great-great grandaddy) or should I pick the folder that contains the *.class files?

                          – mikey
                          Apr 3 '13 at 18:23













                          Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                          – mikey
                          Apr 3 '13 at 19:05





                          Found a different, more extensive set of packages including this one, rolled that into a jar, and so far so good. Thanks!

                          – mikey
                          Apr 3 '13 at 19:05




                          5




                          5





                          It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                          – mikey
                          Apr 5 '13 at 14:44





                          It definitely seems like eclipse can be a bit buggy when it comes to the validation of JSPs. "Turning it off and back on again" helps it regain its footing, but I also found that performing a Project -> Clean... can help as well to set things straight.

                          – mikey
                          Apr 5 '13 at 14:44













                          Which class needs to be selected here?

                          – Fahad Uddin
                          Jun 9 '14 at 21:17





                          Which class needs to be selected here?

                          – Fahad Uddin
                          Jun 9 '14 at 21:17




                          2




                          2





                          The issue was solved after I restarted Eclipse

                          – Zvi
                          Mar 13 '17 at 7:21





                          The issue was solved after I restarted Eclipse

                          – Zvi
                          Mar 13 '17 at 7:21













                          40














                          Also If you are using mavenised project then try to update your project by clicking Alt+F5.
                          Or right click on the application and go to maven /update project.



                          It builds all your components and resolves if any import error is there.






                          share|improve this answer



















                          • 4





                            Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                            – XMight
                            Mar 29 '16 at 8:19






                          • 1





                            I'd like to echo @XMight 's question.

                            – Erutan409
                            Mar 17 '17 at 19:25













                          • I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                            – milijan
                            Dec 22 '17 at 11:11
















                          40














                          Also If you are using mavenised project then try to update your project by clicking Alt+F5.
                          Or right click on the application and go to maven /update project.



                          It builds all your components and resolves if any import error is there.






                          share|improve this answer



















                          • 4





                            Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                            – XMight
                            Mar 29 '16 at 8:19






                          • 1





                            I'd like to echo @XMight 's question.

                            – Erutan409
                            Mar 17 '17 at 19:25













                          • I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                            – milijan
                            Dec 22 '17 at 11:11














                          40












                          40








                          40







                          Also If you are using mavenised project then try to update your project by clicking Alt+F5.
                          Or right click on the application and go to maven /update project.



                          It builds all your components and resolves if any import error is there.






                          share|improve this answer













                          Also If you are using mavenised project then try to update your project by clicking Alt+F5.
                          Or right click on the application and go to maven /update project.



                          It builds all your components and resolves if any import error is there.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Oct 28 '14 at 7:35









                          AKSAKS

                          40036




                          40036








                          • 4





                            Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                            – XMight
                            Mar 29 '16 at 8:19






                          • 1





                            I'd like to echo @XMight 's question.

                            – Erutan409
                            Mar 17 '17 at 19:25













                          • I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                            – milijan
                            Dec 22 '17 at 11:11














                          • 4





                            Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                            – XMight
                            Mar 29 '16 at 8:19






                          • 1





                            I'd like to echo @XMight 's question.

                            – Erutan409
                            Mar 17 '17 at 19:25













                          • I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                            – milijan
                            Dec 22 '17 at 11:11








                          4




                          4





                          Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                          – XMight
                          Mar 29 '16 at 8:19





                          Can someone explain why it is necessarily to do this? Why eclipse can't figure it out by itself?

                          – XMight
                          Mar 29 '16 at 8:19




                          1




                          1





                          I'd like to echo @XMight 's question.

                          – Erutan409
                          Mar 17 '17 at 19:25







                          I'd like to echo @XMight 's question.

                          – Erutan409
                          Mar 17 '17 at 19:25















                          I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                          – milijan
                          Dec 22 '17 at 11:11





                          I had this issue and tried updating maven project countless times but it did not solve it until I deleted JDT indexes like this: [answer on How would you access Eclipse JDT index?] (stackoverflow.com/a/3898528/6359607)

                          – milijan
                          Dec 22 '17 at 11:11











                          9














                          To solve the error "...cannot be resolved to a type.." do the followings:




                          1. Right click on the class and select "Build Path-->Exclude"

                          2. Again right click on the class and select "Build Path-->Include"


                          It works for me.






                          share|improve this answer




























                            9














                            To solve the error "...cannot be resolved to a type.." do the followings:




                            1. Right click on the class and select "Build Path-->Exclude"

                            2. Again right click on the class and select "Build Path-->Include"


                            It works for me.






                            share|improve this answer


























                              9












                              9








                              9







                              To solve the error "...cannot be resolved to a type.." do the followings:




                              1. Right click on the class and select "Build Path-->Exclude"

                              2. Again right click on the class and select "Build Path-->Include"


                              It works for me.






                              share|improve this answer













                              To solve the error "...cannot be resolved to a type.." do the followings:




                              1. Right click on the class and select "Build Path-->Exclude"

                              2. Again right click on the class and select "Build Path-->Include"


                              It works for me.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Apr 21 '16 at 10:51









                              Amit Kumar DasAmit Kumar Das

                              9915




                              9915























                                  4














                                  Project -> Clean



                                  can at least sometimes be sufficient to resolve the matter.






                                  share|improve this answer




























                                    4














                                    Project -> Clean



                                    can at least sometimes be sufficient to resolve the matter.






                                    share|improve this answer


























                                      4












                                      4








                                      4







                                      Project -> Clean



                                      can at least sometimes be sufficient to resolve the matter.






                                      share|improve this answer













                                      Project -> Clean



                                      can at least sometimes be sufficient to resolve the matter.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 12 '18 at 18:47









                                      JoolJool

                                      1,379119




                                      1,379119























                                          2














                                          For maven users:




                                          • Right click on the project

                                          • Maven

                                          • Update Project






                                          share|improve this answer
























                                          • For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                            – Curtis Yallop
                                            Sep 25 '18 at 16:58
















                                          2














                                          For maven users:




                                          • Right click on the project

                                          • Maven

                                          • Update Project






                                          share|improve this answer
























                                          • For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                            – Curtis Yallop
                                            Sep 25 '18 at 16:58














                                          2












                                          2








                                          2







                                          For maven users:




                                          • Right click on the project

                                          • Maven

                                          • Update Project






                                          share|improve this answer













                                          For maven users:




                                          • Right click on the project

                                          • Maven

                                          • Update Project







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Mar 17 '17 at 15:44









                                          Paulo RodriguesPaulo Rodrigues

                                          212




                                          212













                                          • For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                            – Curtis Yallop
                                            Sep 25 '18 at 16:58



















                                          • For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                            – Curtis Yallop
                                            Sep 25 '18 at 16:58

















                                          For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                          – Curtis Yallop
                                          Sep 25 '18 at 16:58





                                          For me, in addition, after running maven-update-project on all projects, I sometimes have to then do a maven-update-project on our core library. Oddly, both steps are necessary in that order.

                                          – Curtis Yallop
                                          Sep 25 '18 at 16:58











                                          1















                                          • Right click Project > Properties


                                          • Java Build Path > Add Class Folder

                                          • Select the bin folder

                                          • Click ok

                                          • Switch Order and Export tab

                                          • Select the newly added bin path move UP

                                          • Click Apply button


                                          enter image description here






                                          share|improve this answer




























                                            1















                                            • Right click Project > Properties


                                            • Java Build Path > Add Class Folder

                                            • Select the bin folder

                                            • Click ok

                                            • Switch Order and Export tab

                                            • Select the newly added bin path move UP

                                            • Click Apply button


                                            enter image description here






                                            share|improve this answer


























                                              1












                                              1








                                              1








                                              • Right click Project > Properties


                                              • Java Build Path > Add Class Folder

                                              • Select the bin folder

                                              • Click ok

                                              • Switch Order and Export tab

                                              • Select the newly added bin path move UP

                                              • Click Apply button


                                              enter image description here






                                              share|improve this answer














                                              • Right click Project > Properties


                                              • Java Build Path > Add Class Folder

                                              • Select the bin folder

                                              • Click ok

                                              • Switch Order and Export tab

                                              • Select the newly added bin path move UP

                                              • Click Apply button


                                              enter image description here







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Jul 28 '17 at 18:43









                                              Prashanth SamsPrashanth Sams

                                              7,179105176




                                              7,179105176























                                                  1














                                                  There are two ways to solve the issue "cannot be resolved to a type
                                                  ":




                                                  1. For non maven project, add jars manually in a folder and add it in java build path. This would solve the compilation errors.

                                                  2. For maven project, right click on the project and go to maven -> update project. Select all the projects where you are getting compilation errors and also check "Force update of snapshots/releases". This will update the project and fix the compilation errors.






                                                  share|improve this answer




























                                                    1














                                                    There are two ways to solve the issue "cannot be resolved to a type
                                                    ":




                                                    1. For non maven project, add jars manually in a folder and add it in java build path. This would solve the compilation errors.

                                                    2. For maven project, right click on the project and go to maven -> update project. Select all the projects where you are getting compilation errors and also check "Force update of snapshots/releases". This will update the project and fix the compilation errors.






                                                    share|improve this answer


























                                                      1












                                                      1








                                                      1







                                                      There are two ways to solve the issue "cannot be resolved to a type
                                                      ":




                                                      1. For non maven project, add jars manually in a folder and add it in java build path. This would solve the compilation errors.

                                                      2. For maven project, right click on the project and go to maven -> update project. Select all the projects where you are getting compilation errors and also check "Force update of snapshots/releases". This will update the project and fix the compilation errors.






                                                      share|improve this answer













                                                      There are two ways to solve the issue "cannot be resolved to a type
                                                      ":




                                                      1. For non maven project, add jars manually in a folder and add it in java build path. This would solve the compilation errors.

                                                      2. For maven project, right click on the project and go to maven -> update project. Select all the projects where you are getting compilation errors and also check "Force update of snapshots/releases". This will update the project and fix the compilation errors.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered May 3 '18 at 6:37









                                                      Swati GourSwati Gour

                                                      514




                                                      514























                                                          1














                                                          Easy Solution:

                                                          Go to




                                                          Project property -> java builder path -> maven -> find c3p0-0.9.5.2.jar




                                                          and see the location where the file is stored in the local repository and go to this location and delete the repository manually.






                                                          <img src="https://i.stack.imgur.com/dROTl.png" alt="G">








                                                          share|improve this answer






























                                                            1














                                                            Easy Solution:

                                                            Go to




                                                            Project property -> java builder path -> maven -> find c3p0-0.9.5.2.jar




                                                            and see the location where the file is stored in the local repository and go to this location and delete the repository manually.






                                                            <img src="https://i.stack.imgur.com/dROTl.png" alt="G">








                                                            share|improve this answer




























                                                              1












                                                              1








                                                              1







                                                              Easy Solution:

                                                              Go to




                                                              Project property -> java builder path -> maven -> find c3p0-0.9.5.2.jar




                                                              and see the location where the file is stored in the local repository and go to this location and delete the repository manually.






                                                              <img src="https://i.stack.imgur.com/dROTl.png" alt="G">








                                                              share|improve this answer















                                                              Easy Solution:

                                                              Go to




                                                              Project property -> java builder path -> maven -> find c3p0-0.9.5.2.jar




                                                              and see the location where the file is stored in the local repository and go to this location and delete the repository manually.






                                                              <img src="https://i.stack.imgur.com/dROTl.png" alt="G">








                                                              <img src="https://i.stack.imgur.com/dROTl.png" alt="G">





                                                              <img src="https://i.stack.imgur.com/dROTl.png" alt="G">






                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Sep 17 '18 at 22:14









                                                              zx485

                                                              15.4k133248




                                                              15.4k133248










                                                              answered Sep 17 '18 at 21:38









                                                              Nazrul Islam RiadNazrul Islam Riad

                                                              113




                                                              113























                                                                  0














                                                                  Solved the problem by dropping the jar into WEB_INF/lib.






                                                                  share|improve this answer




























                                                                    0














                                                                    Solved the problem by dropping the jar into WEB_INF/lib.






                                                                    share|improve this answer


























                                                                      0












                                                                      0








                                                                      0







                                                                      Solved the problem by dropping the jar into WEB_INF/lib.






                                                                      share|improve this answer













                                                                      Solved the problem by dropping the jar into WEB_INF/lib.







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Sep 8 '16 at 15:09









                                                                      Andreas L.Andreas L.

                                                                      1,9171521




                                                                      1,9171521























                                                                          0














                                                                          copying the jar files will resolve. If by any chance you are copying the code from any tutorials, make sure the class names are spelled in correct case...for example i copied a code from one of the tutorials which had solr in S cap. Eclipse was continiously throwing the error and i also did a bit of googling ...everything was ok and it took 30 mins for me to realise the cap small issue. Am sure this will help someone






                                                                          share|improve this answer




























                                                                            0














                                                                            copying the jar files will resolve. If by any chance you are copying the code from any tutorials, make sure the class names are spelled in correct case...for example i copied a code from one of the tutorials which had solr in S cap. Eclipse was continiously throwing the error and i also did a bit of googling ...everything was ok and it took 30 mins for me to realise the cap small issue. Am sure this will help someone






                                                                            share|improve this answer


























                                                                              0












                                                                              0








                                                                              0







                                                                              copying the jar files will resolve. If by any chance you are copying the code from any tutorials, make sure the class names are spelled in correct case...for example i copied a code from one of the tutorials which had solr in S cap. Eclipse was continiously throwing the error and i also did a bit of googling ...everything was ok and it took 30 mins for me to realise the cap small issue. Am sure this will help someone






                                                                              share|improve this answer













                                                                              copying the jar files will resolve. If by any chance you are copying the code from any tutorials, make sure the class names are spelled in correct case...for example i copied a code from one of the tutorials which had solr in S cap. Eclipse was continiously throwing the error and i also did a bit of googling ...everything was ok and it took 30 mins for me to realise the cap small issue. Am sure this will help someone







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered May 22 '17 at 11:57









                                                                              Harish NarayananHarish Narayanan

                                                                              94




                                                                              94























                                                                                  0














                                                                                  For many new users don't forget to add an asterisk (*) after your import statements if you wanna use all the classes in a package....for example



                                                                                  import java.io.*;

                                                                                  public class Learning
                                                                                  {
                                                                                  public static void main(String args)
                                                                                  {
                                                                                  BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                  // no error
                                                                                  }
                                                                                  }


                                                                                  ================================================================



                                                                                  import java.io;

                                                                                  public class Learning
                                                                                  {
                                                                                  public static void main(String args)
                                                                                  {
                                                                                  BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                  // BufferedInputStream cannot be resolved to a type error
                                                                                  }
                                                                                  }





                                                                                  share|improve this answer




























                                                                                    0














                                                                                    For many new users don't forget to add an asterisk (*) after your import statements if you wanna use all the classes in a package....for example



                                                                                    import java.io.*;

                                                                                    public class Learning
                                                                                    {
                                                                                    public static void main(String args)
                                                                                    {
                                                                                    BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                    // no error
                                                                                    }
                                                                                    }


                                                                                    ================================================================



                                                                                    import java.io;

                                                                                    public class Learning
                                                                                    {
                                                                                    public static void main(String args)
                                                                                    {
                                                                                    BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                    // BufferedInputStream cannot be resolved to a type error
                                                                                    }
                                                                                    }





                                                                                    share|improve this answer


























                                                                                      0












                                                                                      0








                                                                                      0







                                                                                      For many new users don't forget to add an asterisk (*) after your import statements if you wanna use all the classes in a package....for example



                                                                                      import java.io.*;

                                                                                      public class Learning
                                                                                      {
                                                                                      public static void main(String args)
                                                                                      {
                                                                                      BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                      // no error
                                                                                      }
                                                                                      }


                                                                                      ================================================================



                                                                                      import java.io;

                                                                                      public class Learning
                                                                                      {
                                                                                      public static void main(String args)
                                                                                      {
                                                                                      BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                      // BufferedInputStream cannot be resolved to a type error
                                                                                      }
                                                                                      }





                                                                                      share|improve this answer













                                                                                      For many new users don't forget to add an asterisk (*) after your import statements if you wanna use all the classes in a package....for example



                                                                                      import java.io.*;

                                                                                      public class Learning
                                                                                      {
                                                                                      public static void main(String args)
                                                                                      {
                                                                                      BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                      // no error
                                                                                      }
                                                                                      }


                                                                                      ================================================================



                                                                                      import java.io;

                                                                                      public class Learning
                                                                                      {
                                                                                      public static void main(String args)
                                                                                      {
                                                                                      BufferedInputStream sd = new BufferedInputStream(System.in);
                                                                                      // BufferedInputStream cannot be resolved to a type error
                                                                                      }
                                                                                      }






                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered Aug 18 '17 at 10:38









                                                                                      JamiscoJamisco

                                                                                      3791612




                                                                                      3791612























                                                                                          0














                                                                                          Solution :
                                                                                          1.Project -> Build Path -> Configure Build Path



                                                                                          2.Select Java Build path on the left menu, and select "Source"



                                                                                          3.Under Project select Include(All) and click OK



                                                                                          Cause :
                                                                                          The issue might because u might have deleted the CLASS files or dependencies on the project






                                                                                          share|improve this answer




























                                                                                            0














                                                                                            Solution :
                                                                                            1.Project -> Build Path -> Configure Build Path



                                                                                            2.Select Java Build path on the left menu, and select "Source"



                                                                                            3.Under Project select Include(All) and click OK



                                                                                            Cause :
                                                                                            The issue might because u might have deleted the CLASS files or dependencies on the project






                                                                                            share|improve this answer


























                                                                                              0












                                                                                              0








                                                                                              0







                                                                                              Solution :
                                                                                              1.Project -> Build Path -> Configure Build Path



                                                                                              2.Select Java Build path on the left menu, and select "Source"



                                                                                              3.Under Project select Include(All) and click OK



                                                                                              Cause :
                                                                                              The issue might because u might have deleted the CLASS files or dependencies on the project






                                                                                              share|improve this answer













                                                                                              Solution :
                                                                                              1.Project -> Build Path -> Configure Build Path



                                                                                              2.Select Java Build path on the left menu, and select "Source"



                                                                                              3.Under Project select Include(All) and click OK



                                                                                              Cause :
                                                                                              The issue might because u might have deleted the CLASS files or dependencies on the project







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered Mar 20 '18 at 14:20









                                                                                              sundersparkssundersparks

                                                                                              11




                                                                                              11























                                                                                                  0














                                                                                                  Project -> Build Path -> Configure Build Path
                                                                                                  Select Java Build path on the left menu, and select "Source"
                                                                                                  click on Excluded and then Include(All) and then click OK
                                                                                                  Cause : The issue might because u might have deleted the CLASS files
                                                                                                  or dependencies on the project


                                                                                                  For maven users:



                                                                                                  Right click on the project



                                                                                                  Maven



                                                                                                  Update Project






                                                                                                  share|improve this answer






























                                                                                                    0














                                                                                                    Project -> Build Path -> Configure Build Path
                                                                                                    Select Java Build path on the left menu, and select "Source"
                                                                                                    click on Excluded and then Include(All) and then click OK
                                                                                                    Cause : The issue might because u might have deleted the CLASS files
                                                                                                    or dependencies on the project


                                                                                                    For maven users:



                                                                                                    Right click on the project



                                                                                                    Maven



                                                                                                    Update Project






                                                                                                    share|improve this answer




























                                                                                                      0












                                                                                                      0








                                                                                                      0







                                                                                                      Project -> Build Path -> Configure Build Path
                                                                                                      Select Java Build path on the left menu, and select "Source"
                                                                                                      click on Excluded and then Include(All) and then click OK
                                                                                                      Cause : The issue might because u might have deleted the CLASS files
                                                                                                      or dependencies on the project


                                                                                                      For maven users:



                                                                                                      Right click on the project



                                                                                                      Maven



                                                                                                      Update Project






                                                                                                      share|improve this answer















                                                                                                      Project -> Build Path -> Configure Build Path
                                                                                                      Select Java Build path on the left menu, and select "Source"
                                                                                                      click on Excluded and then Include(All) and then click OK
                                                                                                      Cause : The issue might because u might have deleted the CLASS files
                                                                                                      or dependencies on the project


                                                                                                      For maven users:



                                                                                                      Right click on the project



                                                                                                      Maven



                                                                                                      Update Project







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited Sep 18 '18 at 15:13

























                                                                                                      answered Jun 4 '18 at 10:56









                                                                                                      Devendra SingraulDevendra Singraul

                                                                                                      174212




                                                                                                      174212























                                                                                                          0














                                                                                                          First you need to update the pom.xml by adding below



                                                                                                              <dependency>
                                                                                                          <groupId>org.springframework</groupId>
                                                                                                          <artifactId>spring-web</artifactId>
                                                                                                          <version>4.1.6.RELEASE</version>
                                                                                                          </dependency>


                                                                                                          1] Right click your project name.



                                                                                                          2] Click Properties.



                                                                                                          3] Click Java Build Path.



                                                                                                          4] Check on 'Maven Dependencies' in Order and Export tabl.



                                                                                                          In my case, previously it was not enabled. So when I enabled it my @GetMapping annotation works fine..






                                                                                                          share|improve this answer




























                                                                                                            0














                                                                                                            First you need to update the pom.xml by adding below



                                                                                                                <dependency>
                                                                                                            <groupId>org.springframework</groupId>
                                                                                                            <artifactId>spring-web</artifactId>
                                                                                                            <version>4.1.6.RELEASE</version>
                                                                                                            </dependency>


                                                                                                            1] Right click your project name.



                                                                                                            2] Click Properties.



                                                                                                            3] Click Java Build Path.



                                                                                                            4] Check on 'Maven Dependencies' in Order and Export tabl.



                                                                                                            In my case, previously it was not enabled. So when I enabled it my @GetMapping annotation works fine..






                                                                                                            share|improve this answer


























                                                                                                              0












                                                                                                              0








                                                                                                              0







                                                                                                              First you need to update the pom.xml by adding below



                                                                                                                  <dependency>
                                                                                                              <groupId>org.springframework</groupId>
                                                                                                              <artifactId>spring-web</artifactId>
                                                                                                              <version>4.1.6.RELEASE</version>
                                                                                                              </dependency>


                                                                                                              1] Right click your project name.



                                                                                                              2] Click Properties.



                                                                                                              3] Click Java Build Path.



                                                                                                              4] Check on 'Maven Dependencies' in Order and Export tabl.



                                                                                                              In my case, previously it was not enabled. So when I enabled it my @GetMapping annotation works fine..






                                                                                                              share|improve this answer













                                                                                                              First you need to update the pom.xml by adding below



                                                                                                                  <dependency>
                                                                                                              <groupId>org.springframework</groupId>
                                                                                                              <artifactId>spring-web</artifactId>
                                                                                                              <version>4.1.6.RELEASE</version>
                                                                                                              </dependency>


                                                                                                              1] Right click your project name.



                                                                                                              2] Click Properties.



                                                                                                              3] Click Java Build Path.



                                                                                                              4] Check on 'Maven Dependencies' in Order and Export tabl.



                                                                                                              In my case, previously it was not enabled. So when I enabled it my @GetMapping annotation works fine..







                                                                                                              share|improve this answer












                                                                                                              share|improve this answer



                                                                                                              share|improve this answer










                                                                                                              answered Nov 22 '18 at 17:04









                                                                                                              AnnuAnnu

                                                                                                              3023621




                                                                                                              3023621























                                                                                                                  0














                                                                                                                  Also, there is the solution for IvyDE users. Right click on project -> Ivy -> resolve
                                                                                                                  It's necessary to set ivy.mirror property in build.properties






                                                                                                                  share|improve this answer






























                                                                                                                    0














                                                                                                                    Also, there is the solution for IvyDE users. Right click on project -> Ivy -> resolve
                                                                                                                    It's necessary to set ivy.mirror property in build.properties






                                                                                                                    share|improve this answer




























                                                                                                                      0












                                                                                                                      0








                                                                                                                      0







                                                                                                                      Also, there is the solution for IvyDE users. Right click on project -> Ivy -> resolve
                                                                                                                      It's necessary to set ivy.mirror property in build.properties






                                                                                                                      share|improve this answer















                                                                                                                      Also, there is the solution for IvyDE users. Right click on project -> Ivy -> resolve
                                                                                                                      It's necessary to set ivy.mirror property in build.properties







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited Apr 3 at 11:45

























                                                                                                                      answered Apr 3 at 11:02









                                                                                                                      andronandron

                                                                                                                      218




                                                                                                                      218






























                                                                                                                          draft saved

                                                                                                                          draft discarded




















































                                                                                                                          Thanks for contributing an answer to Stack Overflow!


                                                                                                                          • Please be sure to answer the question. Provide details and share your research!

                                                                                                                          But avoid



                                                                                                                          • Asking for help, clarification, or responding to other answers.

                                                                                                                          • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                          To learn more, see our tips on writing great answers.




                                                                                                                          draft saved


                                                                                                                          draft discarded














                                                                                                                          StackExchange.ready(
                                                                                                                          function () {
                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15794821%2feclipse-error-cannot-be-resolved-to-a-type%23new-answer', 'question_page');
                                                                                                                          }
                                                                                                                          );

                                                                                                                          Post as a guest















                                                                                                                          Required, but never shown





















































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown

































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown







                                                                                                                          Popular posts from this blog

                                                                                                                          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                                                                                                          Alcedinidae

                                                                                                                          RAC Tourist Trophy