This is not possible.
If you simply want to execute some code at the current place you can use the
Expressions view and enter your code as an expression. The methods called by the expression evaluation will run in the current debugging context.
Put the cursor on the line of your choice and either hit ctrl-R ("Run to line") or right-click and select "Run to line" from the context menu.
Just right click on desired line and choose run to line.That's it...
I like ankon's answer best, but another option (that will only work for your specific instance -- if that) is to stop at a breakpoint on your
if and modify the variable(s) evaluated in the conditional such that it returns false (from the "Variables" view, right click on a variable and click "Change Value...")
I thought that this was totally possible in older versions of eclipse, I thought I had the memory of doing it, but I guess I just implanted that memory when I worked in Visual Studio. From what I'm reading it might come to the jvm and not eclipse itself, there are pages where it's suggested that the jvm cannot handle that.
In my opinion Eclipse is many many times better than VS, I worked extensively in both and since I discovered Eclipse I was always in pain when I had to work in VS. But not having this feature is definitely hurting right now hehe.
You can jump directly to any other method call inside of the currently debugged method. Select some method call below your current instruction pointer and use "Step into selection" from the context menu.
unfortunately not possible to step forward with instruction pointer (program counter), so what you need to do instead is to introduce your own "debugging" variables that you can test on - lets say you want to step around a loop that takes too long, then add a variable and test on its increased value and then encapsulate the loop in an if with that variable. I know this is ugly, but it gets it done - or you could just develop in C++ :-)
A trick I use is to type a space in your class, somewhere safe such as in the comment line; immediately delete it and save the class. This forces the execution point to jump to the beginning of your current method. Not ideal, I admit, but it can sometimes be used as a workaround to achieve what you want.
Although in the default installation of eclipse it is not possible to do directly move the execution point like in Visual Studio, there may exist an eclipse plugin which provides that functionality somewhere. Have a search around.
Moving the pointer like in Visual Studio is not possible, however workarounds are:
Going backwards to the beginning of the currently executed method: Select the method from the debug call stack, right click -> "Drop to frame" et voila you're back at the beginning of the method.
Now to reach your desired line select the line by clicking in it and hit ctrl+r or right click the line and select "Run to line".
These techniques are hugely helpful and reduce debugging efforts massively, enjoy!
This is possible...
Drop to frame - When stepping through your code, you might occasionally step too far, or step over a line you meant to step into. Rather than restarting your debug session, you can use the Drop to Frame action to quickly go back to the beginning of a method. Select the stack frame corresponding to the Java method you wish to restart, and select Drop to Frame from Debug view toolbar or the stack frame's context menu. The current instruction pointer will be reset to the first executable statement in the method. This works for non-top stack frames as well.
Note that Drop to frame is only available when debugging with a 1.4 or higher VM, or the J9 VM. There are some situations where a JVM may be unable to pop the desired frames from the stack. For example, it is generally impossible to drop to the bottom frame of the stack or to any frame below a native method.
- Moving the instruction pointer while debugging Java in Eclipse
- Eclipse plugin for creating Java code automatically to reproduce the state of an object for fast testing while debugging
- How to execute some function in eclipse while debugging a java program?
- Catching exceptions as an expression while debugging Java in Eclipse IDE
- Stop code execution while debugging in Eclipse without terminating the thread
- viewing canvas/bitmap on the fly while debugging in eclipse
- How to debug Groovy code via the remote Java application debugging in Eclipse
- Which JRE version to use while making new Java Project in Eclipse and what are the drawbacks?
- What is the default properties that eclipse uses to launch a java process in its debugging mode?
- Debugging a remote Java application with Eclipse as the server (Socket listen)
- Execution fails via java -jar while the same code runs fine through eclipse
- Connection refused error in java using Google map API with eclipse IDE while the same URL is giving me the result in browsers
- Android on Eclipse Follow the right Android source code version while debugging
- Eclipse 2019-09 - Getting the error: "Could not determine Java version", while creating a new project
- java null pointer exception while configuring axis2 in eclipse
- Java APIs Classes does not show variables value while debugging in Eclipse 3.x
- Changing the value of a long array while eclipse debugging
- how do i take step reverse while doing debugging in eclipse ide for java
- Why am i getting a message 'Obsolete Methods on the Stack' in Java on Eclipse while compiling code,
- While debugging in eclipse the code navigation buttons get disabled, the stackframe also is not visible
- Prevent eclipse from moving to line of code while debugging
- Eclipse JDT: How do I auto-move dependencies of a statement as well, while moving the statement
- How to pass a java file name to a script file while saving the java file in eclipse
- When debugging with Eclipse what are the best ways to track down Null Pointer Exceptions?
- How to quickly find/switch to the Debug Current Instruction Pointer in Eclipse
- Getting an compillation error while running java maven project in the eclipse IDE
- Where the file will be located while using IO Streams in Java In Eclipse IDE?
- While debugging PHP, the visual of the debugged line won't change to the next in Eclipse
- Eclipse : Can we make modifications on to the source code while debugging the Application inside Eclipse
- Change in code while debugging in java class with eclipse
More Query from same tag
- Debug GlassFish global filter with Eclipse
- How to remove 'unremovable' consoles from eclipse
- What is the correct way to use maven and eclipse?
- Trying to rename recorded file with a method
- Error when executing web service client
- Eclipse not finding some declared methods (in Vaadin libraries)
- How to tell my Eclipse Helios CTD that a project is a C/C++ one?
- Java code - area of a polygon
- Difference in Run & Debugg mode in Eclipse for Perl
- Plugin Development, where to save user data?
- Outline view plugin for shells scripts in Eclipse
- Different class size between Eclipse IDE and javac
- GWT Maven - webapp files getting deleted when running in dev mode
- Conflicting dependency while eclipse updating; Common Navigator View installed threee times
- Refactoring in Eclipse/Java: Apply "Extract Method" (Alt+Shift+M) afterwards
- JPA: How to generate entities from another schema?
- How to debug java applet
- Unexpected pop window handling while running script in selenium web driver using java
- Working with NDK in Eclipse
- Eclipse: The declared package does not match the expected package
- How to replace "texture = new Texture(Gdx.files.internal("data/texture.png"));" with another one
- Why "Install New Software..." menu entry is located under Help in eclipse
- Android SDK manager linux permission issue
- Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined
- Encoding error?
- Start off with a default "hello world" project in Emacs
- Eclipse Remote Application Platform (RAP) - Deploy Custom Theme
- bug with "Extract Android String" option in eclipse
- How to specify a custom action on Java exception in Eclipse IDE?
- Eclipse can't save file in webapps folder