Debugging Java in Eclipse stops without a breakpoint












1














I wanna debug very simple code that consists of two simplest classes.



package test.pack;

public class TestClass {

public static void main(String args) {
TestClassTwo tc2 = new TestClassTwo();
}

}


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



package test.pack;

public class TestClassTwo {

public TestClassTwo() {
System.out.println(this);
}

}


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



So, when I toggle on breakpoint on inizialization of class TestClassTwo and run debug by [F11] and [F5], I should get into constructor of TestClassTwo.
But instead of this breakpoint hits in such place where I don't set any breakpoints.
It is shown on this pic



I try this on [Eclipse IDE for Java EE Developers] and [Eclipse IDE for Java Developers], also I download and install last version of JDK from oficial Oracle site.



But there is one limitation is that I should to use Java version 1.7 in my project according to the technical task from business side.



I was trying to use solutions from this topic
Debug hit without breakpoint - Eclipse, but it was not helpful.



Next, I attach screenshots that can somehow help solve my problem.



Java library in settings of project



Installed JRE in preferences of Eclipse



Java version in cmd



System variables in Environment variables



System variables in Environment variables also



Windows version










share|improve this question






















  • What is F11 mapped to? F5?
    – nitind
    Nov 15 at 22:57










  • What did it look like before you hit F5?
    – nitind
    Nov 15 at 23:11
















1














I wanna debug very simple code that consists of two simplest classes.



package test.pack;

public class TestClass {

public static void main(String args) {
TestClassTwo tc2 = new TestClassTwo();
}

}


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



package test.pack;

public class TestClassTwo {

public TestClassTwo() {
System.out.println(this);
}

}


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



So, when I toggle on breakpoint on inizialization of class TestClassTwo and run debug by [F11] and [F5], I should get into constructor of TestClassTwo.
But instead of this breakpoint hits in such place where I don't set any breakpoints.
It is shown on this pic



I try this on [Eclipse IDE for Java EE Developers] and [Eclipse IDE for Java Developers], also I download and install last version of JDK from oficial Oracle site.



But there is one limitation is that I should to use Java version 1.7 in my project according to the technical task from business side.



I was trying to use solutions from this topic
Debug hit without breakpoint - Eclipse, but it was not helpful.



Next, I attach screenshots that can somehow help solve my problem.



Java library in settings of project



Installed JRE in preferences of Eclipse



Java version in cmd



System variables in Environment variables



System variables in Environment variables also



Windows version










share|improve this question






















  • What is F11 mapped to? F5?
    – nitind
    Nov 15 at 22:57










  • What did it look like before you hit F5?
    – nitind
    Nov 15 at 23:11














1












1








1


1





I wanna debug very simple code that consists of two simplest classes.



package test.pack;

public class TestClass {

public static void main(String args) {
TestClassTwo tc2 = new TestClassTwo();
}

}


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



package test.pack;

public class TestClassTwo {

public TestClassTwo() {
System.out.println(this);
}

}


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



So, when I toggle on breakpoint on inizialization of class TestClassTwo and run debug by [F11] and [F5], I should get into constructor of TestClassTwo.
But instead of this breakpoint hits in such place where I don't set any breakpoints.
It is shown on this pic



I try this on [Eclipse IDE for Java EE Developers] and [Eclipse IDE for Java Developers], also I download and install last version of JDK from oficial Oracle site.



But there is one limitation is that I should to use Java version 1.7 in my project according to the technical task from business side.



I was trying to use solutions from this topic
Debug hit without breakpoint - Eclipse, but it was not helpful.



Next, I attach screenshots that can somehow help solve my problem.



Java library in settings of project



Installed JRE in preferences of Eclipse



Java version in cmd



System variables in Environment variables



System variables in Environment variables also



Windows version










share|improve this question













I wanna debug very simple code that consists of two simplest classes.



package test.pack;

public class TestClass {

public static void main(String args) {
TestClassTwo tc2 = new TestClassTwo();
}

}


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



package test.pack;

public class TestClassTwo {

public TestClassTwo() {
System.out.println(this);
}

}


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



So, when I toggle on breakpoint on inizialization of class TestClassTwo and run debug by [F11] and [F5], I should get into constructor of TestClassTwo.
But instead of this breakpoint hits in such place where I don't set any breakpoints.
It is shown on this pic



I try this on [Eclipse IDE for Java EE Developers] and [Eclipse IDE for Java Developers], also I download and install last version of JDK from oficial Oracle site.



But there is one limitation is that I should to use Java version 1.7 in my project according to the technical task from business side.



I was trying to use solutions from this topic
Debug hit without breakpoint - Eclipse, but it was not helpful.



Next, I attach screenshots that can somehow help solve my problem.



Java library in settings of project



Installed JRE in preferences of Eclipse



Java version in cmd



System variables in Environment variables



System variables in Environment variables also



Windows version







java eclipse ide java-7 breakpoints






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 at 22:49









Andrew Dvoychenkov

62




62












  • What is F11 mapped to? F5?
    – nitind
    Nov 15 at 22:57










  • What did it look like before you hit F5?
    – nitind
    Nov 15 at 23:11


















  • What is F11 mapped to? F5?
    – nitind
    Nov 15 at 22:57










  • What did it look like before you hit F5?
    – nitind
    Nov 15 at 23:11
















What is F11 mapped to? F5?
– nitind
Nov 15 at 22:57




What is F11 mapped to? F5?
– nitind
Nov 15 at 22:57












What did it look like before you hit F5?
– nitind
Nov 15 at 23:11




What did it look like before you hit F5?
– nitind
Nov 15 at 23:11












2 Answers
2






active

oldest

votes


















0














You tried to output this, which means reference on this object, but but tried to call it from constructor, which creates this object. Try calling this code after constructor in another method.



Debug probably crashed because of null reference exception, that causes error in call stack, that's why program crashes instantly.






share|improve this answer





























    0














    First of all, you did everything correct up to this point.



    The 'error', if you want to call it such, arises when you hit F5. Now this command is called step into, which means that it will continue execution in the next deeper stack layer.



    From the code you assumed that this will be the constructor of TestClassTwo, but before java can invoke the constructor it first has to initialize the class itself and that is exactly what the Debug View in the picture indicates.



    Side question: Did you press F5 multiple times to get that deep into ClassLoader.loadClass()?





    For the current execution you can select the second last line in the Debug View, which is



    Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available


    and then hit F7. This will step out of the respective method an continue execution on the previous stack layer, where the call to the constructor of TestClassTwo should follow.





    For future debugging you might want to get familiar with Step Filtering. Step filters allow you to exclude certain portions of code from debugging. They will be executed, but eclipse will automatically 'step over' them.



    At the corresponding preference page, Java > Debug > Step Filtering, eclipse conveniently provides an option to separately enable and disable step filtering for java.lang.ClassLoader.






    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%2f53328970%2fdebugging-java-in-eclipse-stops-without-a-breakpoint%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      You tried to output this, which means reference on this object, but but tried to call it from constructor, which creates this object. Try calling this code after constructor in another method.



      Debug probably crashed because of null reference exception, that causes error in call stack, that's why program crashes instantly.






      share|improve this answer


























        0














        You tried to output this, which means reference on this object, but but tried to call it from constructor, which creates this object. Try calling this code after constructor in another method.



        Debug probably crashed because of null reference exception, that causes error in call stack, that's why program crashes instantly.






        share|improve this answer
























          0












          0








          0






          You tried to output this, which means reference on this object, but but tried to call it from constructor, which creates this object. Try calling this code after constructor in another method.



          Debug probably crashed because of null reference exception, that causes error in call stack, that's why program crashes instantly.






          share|improve this answer












          You tried to output this, which means reference on this object, but but tried to call it from constructor, which creates this object. Try calling this code after constructor in another method.



          Debug probably crashed because of null reference exception, that causes error in call stack, that's why program crashes instantly.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 at 23:06









          Dima Rich

          173




          173

























              0














              First of all, you did everything correct up to this point.



              The 'error', if you want to call it such, arises when you hit F5. Now this command is called step into, which means that it will continue execution in the next deeper stack layer.



              From the code you assumed that this will be the constructor of TestClassTwo, but before java can invoke the constructor it first has to initialize the class itself and that is exactly what the Debug View in the picture indicates.



              Side question: Did you press F5 multiple times to get that deep into ClassLoader.loadClass()?





              For the current execution you can select the second last line in the Debug View, which is



              Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available


              and then hit F7. This will step out of the respective method an continue execution on the previous stack layer, where the call to the constructor of TestClassTwo should follow.





              For future debugging you might want to get familiar with Step Filtering. Step filters allow you to exclude certain portions of code from debugging. They will be executed, but eclipse will automatically 'step over' them.



              At the corresponding preference page, Java > Debug > Step Filtering, eclipse conveniently provides an option to separately enable and disable step filtering for java.lang.ClassLoader.






              share|improve this answer


























                0














                First of all, you did everything correct up to this point.



                The 'error', if you want to call it such, arises when you hit F5. Now this command is called step into, which means that it will continue execution in the next deeper stack layer.



                From the code you assumed that this will be the constructor of TestClassTwo, but before java can invoke the constructor it first has to initialize the class itself and that is exactly what the Debug View in the picture indicates.



                Side question: Did you press F5 multiple times to get that deep into ClassLoader.loadClass()?





                For the current execution you can select the second last line in the Debug View, which is



                Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available


                and then hit F7. This will step out of the respective method an continue execution on the previous stack layer, where the call to the constructor of TestClassTwo should follow.





                For future debugging you might want to get familiar with Step Filtering. Step filters allow you to exclude certain portions of code from debugging. They will be executed, but eclipse will automatically 'step over' them.



                At the corresponding preference page, Java > Debug > Step Filtering, eclipse conveniently provides an option to separately enable and disable step filtering for java.lang.ClassLoader.






                share|improve this answer
























                  0












                  0








                  0






                  First of all, you did everything correct up to this point.



                  The 'error', if you want to call it such, arises when you hit F5. Now this command is called step into, which means that it will continue execution in the next deeper stack layer.



                  From the code you assumed that this will be the constructor of TestClassTwo, but before java can invoke the constructor it first has to initialize the class itself and that is exactly what the Debug View in the picture indicates.



                  Side question: Did you press F5 multiple times to get that deep into ClassLoader.loadClass()?





                  For the current execution you can select the second last line in the Debug View, which is



                  Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available


                  and then hit F7. This will step out of the respective method an continue execution on the previous stack layer, where the call to the constructor of TestClassTwo should follow.





                  For future debugging you might want to get familiar with Step Filtering. Step filters allow you to exclude certain portions of code from debugging. They will be executed, but eclipse will automatically 'step over' them.



                  At the corresponding preference page, Java > Debug > Step Filtering, eclipse conveniently provides an option to separately enable and disable step filtering for java.lang.ClassLoader.






                  share|improve this answer












                  First of all, you did everything correct up to this point.



                  The 'error', if you want to call it such, arises when you hit F5. Now this command is called step into, which means that it will continue execution in the next deeper stack layer.



                  From the code you assumed that this will be the constructor of TestClassTwo, but before java can invoke the constructor it first has to initialize the class itself and that is exactly what the Debug View in the picture indicates.



                  Side question: Did you press F5 multiple times to get that deep into ClassLoader.loadClass()?





                  For the current execution you can select the second last line in the Debug View, which is



                  Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available


                  and then hit F7. This will step out of the respective method an continue execution on the previous stack layer, where the call to the constructor of TestClassTwo should follow.





                  For future debugging you might want to get familiar with Step Filtering. Step filters allow you to exclude certain portions of code from debugging. They will be executed, but eclipse will automatically 'step over' them.



                  At the corresponding preference page, Java > Debug > Step Filtering, eclipse conveniently provides an option to separately enable and disable step filtering for java.lang.ClassLoader.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 at 23:35









                  Izruo

                  1,350315




                  1,350315






























                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f53328970%2fdebugging-java-in-eclipse-stops-without-a-breakpoint%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

                      How to change which sound is reproduced for terminal bell?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?