Eclipse debugger does not recognize new java code - java

I have added new method to my javacode and put breakpoint at the begin of this method and different places. Eclipse debugger go throw the breakpoints in the old code but not in the new added method. I have cleared my project project-> clear to exclude the cache possibility. for me, it appears that eclipse dont recognize the new added Java code.
Any Idea what could be the problem? I use eclipse Juno Service Release 2.

You need to stop debugging and start the program again since the signature has changed. If you want more hot-swap possibilities you need to consider using JRebel or similar tool.

Related

Java source code management with different IDE

Is it necessary to use the same ide to program in java? For example, I use IntelliJ to build a small java project about 2000 lines. Then the marker uses Eclipse IDE to mark this project. Does he need to import all the source code into a new project and set up everything for it? I didn't use any add-on on this IDE.
The reason I asked this question because I receive huge grade duction for using different IDE, the prof response me and said marker need rebuild everything for using different ide.
I drag my source code into Eclipse, and it works very well, so I am confused am I right or wrong?

How can I prevent Eclipse from stepping into Java library code

How can I prevent Eclipse from stepping into Java library code when using Step Into?
What I am used to in other IDEs (like IntelliJ) is that with Step Into you enter the methods defined by yourself or third party libraries but not the methods of the Java framework itself.
Eclipse does that and it really slows down debugging especially if you have calls to your own methods and ones defined in the Java framework in one line. You have to constantly switch between Step Over, Step Into or Step Return if you already stepped in.
You can configure the Eclipse Java debugger to not step into those bits of code by configuring a ‘Step Filter’.
Go to Windows -> Preferences -> Java -> Debug -> Step Filtering.
Check ‘Use Step Filters’.
Check the appropriate options on the screen. You can add parts that are relevant to your own codebase.
Click ‘Apply’.
More you can read about Eclipse Step Filter here
You can even create a filter for your project Package or Java class as well.
Another good link
For the People who wants to know same setting in Intellij Idea please go through below.
The reason intellij Idea do not step into java specific code is, by default Intellij Idea is enabled with below restriction. To add any other classes we can simply add it here. I added org.testng.* classes.
File->Settings-> Build, Execution and Deployment -> Debugger -> stepping

IntelliJ IDEA "Make project automatically" woes

Back in December I switched from Eclipse to IntelliJ IDEA but within a couple of days I switched back. Today I tried IntelliJ again and basically I have only one issue left.
The issue is I want to compile Java classes on saving. The reason is I'm using JRebel which will pick up the new class. I don't want to hit ⌘+F9 every time to compile the changed class.
I read about the EclipseModel plugin but this does not seem to work (anymore) as can be read in the comments on the plugin's page: http://plugins.jetbrains.com/plugin/?id=3822
I also tried the "Make project automatically" but this compiles ALL classes and not only the changed class. This is only not more time consuming it will also cause JRebel to reload all classes.
Any suggestions?
I ended up creating a Macro which does the Save and the Make Build.
I then assigned the Ctrl+S shortcut to this Macro and then it works fine.
What if you just remap the keys from Ctrl+F9 to Ctrl+S? Basically you will just keep up with the habit of pressing Ctrl+S since you do that in Eclipse - just a matter of pressing a different key in IntelliJ.
IntelliJ IDEA 12 indeed comes with out-of-process compiler which compiles the project classes automatically, but it seems to be unpredictable - you might refresh the page and the class is not yet compiled. So in the scenario with JRebel the off-process compilation is no use, unfortunately.
This may not be exactly what you want but normally I leave auto-save on, and when I need to compile the current class I'm working on, I just do Ctrl + Shift + F9.
My IntelliJ IDEA version is 2017.3.4, and I modified some values so that it compiles automatically.

Intellij autobuild - non existent

If I remove a method, the error (elsewhere in code due to no method existing) is not displayed until I manually build project. There is no way to get this to autobuild on save/change ?
Is there an option I am missing somewhere ?
You may try IDEA 12 EAP, it supports background compilation. See http://blogs.jetbrains.com/idea/2012/06/brand-new-compiler-mode-in-intellij-idea-12-leda/ for more details.
Yes there is, the Eclipse Mode plugin. It lets you always compile in the background, like Eclipse does. Works like a charm.
Apart from that: in IntelliJ, don't just delete a method manually, use Refactor > Safe Delete .... It will walk you through all places in your code where the method is used. That's the IntelliJ way to do it.

Java Debugging: Source not found

I am having a problem with Eclipse where I can run my program just fine, but when I try to start the debugger, I get this message
The picture is a little hard to make out, but instead of getting the normal debugging window, instead it says it is throwing a ClassNotFoundException, and is trying to dislay the source for Launcher$ExtClassLoader.
The thing that really baffles me though is that I can run the code just fine, it is only when I click the debug button that I have the problem.
I have also tried debugging at the command line with JDB, and I got the same error.
So far, I have tried Reinstalling Eclipse and downloading (what I believe to be) the correct Java Development tools for Mac OS X.
I have no idea what else I can try, so any help would be greatly appreciated. Let me know if there is any other information I can provide.
Source not found might be legitimate for dynamically loaded code (e.g. Maven).
There are three workarounds known to me (after months of search):
Connect to a running JVM with the debugger and you will see the code.
Use Dynamic Source Lookup plugin for Eclipse from here:
https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup
Use run-jetty-run Maven plugin
http://code.google.com/p/run-jetty-run/
I prefer and recommend 3. It works and starts webapp much faster than jetty:run.
Unfortunately 2. didn't helped me as it has issues with Windows paths with spaces.
I have filled an enhancement request on Eclipse Bugzilla and if you agree this issue "Source not found" should vanish forever, please vote for it here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384065
Do you have the sources for the files that you are using. If you are using Maven (M2Eclipse) you could download the sources. This might solve the problem.
Otherwise you could go and manually attach your sources. Here is how you manually attach sources.
Next you have to attach the sources-
Hope this helps
The "source not found" is a red herring - there may simply be no way to get access to the source that is throwing the error, because it is deep in the guts of the debugger's class loader.
The better question, then, is, "Why is scottrice.ChessPuzzles.ChessPuzzleDriver not being found?" The only possibility that occurs to me at the moment is that something might be weird in your debug configuration. Did you debug the program by just right-clicking a file with a main() and choosing "Debug As" -> "Java Application"?

Categories

Resources