Intellij IDEA - eclipse-like debugging (after launch code change) - eclipse

I don't remember the name of this feature on Eclipse but it is something like that:
start 'Debug build'
Change code
reapply changes (still running that same debug build)
Now you can see the change in 'real time' without having to close the application and having to 'go' to the point you wanted
How can I do this in Intellij IDEA (and if it is possible to do using LibGDX applications)

The feature is called "hot swap". IntelliJ offers you to reload your changed classes every time you compile your application while it's running under a debugger. You can also trigger this explicitly using the Run | Reload Changed Classes menu item.

Related

Old code runs every time I run the program

I just installed netbeans 12.0 again (I formatted my computer previously), I was customizing it but now every time I make a code I have to click on the Clean And Build Project button before clicking on the Run button, which is quite a lot. tired and takes time, when that should be automatic.
For example: I create a System.out.println ("Hello"); , I run the program and nothing appears on the console, I click the Clean And Build button and now it appear on the console; I change the message from "Hello" to "How are you?", I run the program and the "Hello" that I had written previously appears, that is, the application continues executing the previous code until I click Clean And Build. How can i solve this? Greetings.
Follow the below steps.
Note:Make sure your project haven't any errors.
Go to the project Explorer.
Right click on your project.
Select Clean (Now your code will clean).
After the clean build your project.
Then you can run your project.It should be ok

Eclipse Launch Group - How does Launch Mode work?

I am working with STS based on Eclipse
About Run Configurations
I have some Maven configurations for Main executions defined through the Maven Build section. I need execute some of them together, for this goal I am working with the Launch Group section as follows:
From above I added three configurations to run together.
When I added each one, or even if I need update/edit each one - exists the following (observe the bottom part):
From above I did do some experiments about the Post launch action options and I understand clearly how works each one. Until here all is fine.
The situation is about the Launch mode options as follows:
From above I understand run option, it is the common or simplest execution.
But I am not able to figure out - what do or how work the rest of the options:
Inherit
Profile
Database Debug (Not sure if this option/item appears because I have the Dbeaver plugin installed)
Question: therefore how Inherit, Profile and Database Debug work? (Mostly the two first). If some scenarios or situations can be shared about when to use each one, it is appreciate to have a better perspective.
BTW if I choice Profile, appears the following error message (see blue square), as follows, so not sure when would be used (it is confuse)
The launch mode must be supported by the type of the launch configuration to be able to select it without an error.
Maven launch configurations support the launch mode Run only.
For launch configurations that supports the launch mode Run and Debug (like e.g. Java Application launch configurations), also Inherit can be chosen. Inherit means the launch mode of the launch group. Use the drop-down of the Debug button in the main toolbar to launch the launch group in Debug mode or the drop-down of the Run button to launch the launch group in Run mode. Alternatively, a launch group can be executed via the menu Run > Run Configurations... respectively Run > Debug Configurations... in the Run respectively Debug mode.
Launch groups exist since Eclipse Oxygen (4.7). This short video shows them in action. Run and Debug are the basic launch modes. All others with the exception of Inherit are contributed by additional plug-ins. For example, the Profile launch mode comes with Eclipse EclEmma for Java code coverage which is built-in in all Java IDE packages.
The dialog should not offer the option to choose a not supported mode. Maybe this is because plug-ins can add additional launch modes (in your case Database Debug) or maybe because nobody has implemented it yet (Eclipse is open source and contributions like this are welcome).
I have tried to run launch groups in coverage mode but have not been able to make it work. This seems to be a limitation in Eclipse. It would be useful to run a group of unit tests in coverage mode.

Eclipse RCP Launcher ignores exit code EXIT_RELAUNCH

I have an RCP app which exposes the menu contribution for OpenWorkspaceAction which launches the workspace chooser dialog. I launch it as a stand-alone app (i.e. not from the IDE), use the workspace switcher to select another workspace, and the app exits and does not restart again.
My app runs application org.eclispe.ui.ide.workbench, which uses IDEApplication for its IApplication implementation. To see what's going on, I created my application with an IApplication instance that simply extends IDEApplication and duplicates the code from IDEApplication#start in the subclass. I verify that when restarting after selecting a new workspace, it returns exit code EXIT_RELAUNCH. I also verified that the system property eclipse.exitdata is set as expected, i.e. it has the original launch args with the value of -data replaced with the new workspace location. I also see that system property eclipse.exitcode is set to 24. This is all done in OpenWorkspaceAction, and I'm just verifying it before the app exits.
This seems to indicate that the launcher executable is defective. It comes from the eclipse IDE, I presume, as I selected the box to use native launcher artifacts in the product editor, and then I build the product in tycho using the tycho-p2-director plug-in. But I tried replacing the launcher executable with the launcher from my IDE (which handles relaunch properly), and also with the launcher executable from an RCP app made by someone else, which also handles relaunch properly.
I don't know where to go from here. All the system properties are being set properly to cause the launcher to re-launch, so it really seems to be a problem with the launcher. But then replacing the launcher with one that works in other apps doesn't help. I also tried replacing the launcher and native GTK launcher plug-ins with ones from the IDE and working RCP app. Nothing I do makes it relaunch.
I modified the exit code in IDEApplication.start() to return EXIT_RESTART, and the app does re-start. But then it doesn't respect the exit data, because it re-starts with the same args used originally, without replacing the -data value.
My app is based on Luna, and I tried replacing the launcher artifacts with files from from Luna as well as Mars installations. I'm running on CentOS 6.7
EDIT: to clarify what's happening, the launcher executable exits when IDEApplication returns EXIT_RELAUNCH from the start() method. The launcher program is supposed to invoke the JVM again with the args found in system property eclipse.exitdata, but it terminates execution instead. If start() returns EXIT_RESTART, the launcher invokes the JVM again, but with the original command arguments, without a new value for -data, as it's designed to do when it sees that exit status. So the problem is that the launcher terminates instead of re-launching the JVM when exit status is EXIT_RELAUNCH.

How to have change debugger setting in Eclipse for a launch file

His,
I have been trying to find out why starting DevMode with Debugger from Eclipse was so slow and noticed in the list of processes on my machine the following line:
/usr/lib/jvm/jdk1.6.0_14/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:47248 ...
Apparently the application is suspended to wait until the debugger is connected which takes about 2 minutes. I would like to set "suspend=n". Does anyone know where I could set this directive. The vm section in Eclipse launch configuration is empty and if I paste the updated debugger config there is a error telling that the values are entered twice.
As I understand it, Eclipse takes this config from somewhere and inserts it automatically when I run launch configurations in debugger mode.
Thanks
You can't remove that parameter and, if you could, it wouldn't make a difference. When you connect a new browser to the GWT OOPHM instance it has to compile the entire project for use in development mode. This is what takes time, not waiting for the debugger to attach.

Whats the shortcut to Debug in PyDev using Eclipse

The shortcut key is F11 to start debugging. But issue is that I have to be on that file and then hit F11 to start debugging.
Eg.
my file to launch the application is "launch.py" and "example.py".
example.py is open in the editor whereas launch.py is not.
Now, if I hit F11 it will try to launch the application using "example.py" and terminates due to error (as expected).
So then I have to open the "launch.py" in the editor and then hit F11 to start debugging the application.
Is there any neater way to configure the debugging, so that it starts the application in single hit/key?
Edit: example.py is some other file (some module). It does not launch the application.
As this PyDev Eclipse Tutorial suggests:
After the first run, if you type Ctrl+F11, the last file ran is re-run. Or, if you type just F11, a debug session is started with your last run. Let's test this...
Note: This behavior changed in Eclipse 3.3 -- but it's generally recommended to restore it in the preferences at: window > preferences > Run/Debug > Launching and set the Launch Operation to Always launch the previously launched application.
This tutorial will always consider this as the default option.
So, did you have this option selected?
If you have launch at least once launch.py, then you can re-launch it easily.
Although this isn't strictly an answer to what was asked initially, it might help someone looking here that had the same problem as me...
I'm a Java developer mainly, so have the Java view open almost all the time. However, sometimes I want to run some python file to test something (or just create a quick python script, and run it)...
In the Java editor, if the current class has a main(String[] args) method, I run it with (and popup the dialog to ask me what exactly I'd like to run in the middle)
alt+shift+x, j
Unfortunately, that doesn't work in the Python view, and I've not found a similar solution - it just asks me if I'd like to run it as a Java app... however, as the VonC says, you can run the last run thing (provided you've set the preferences accordingly) with
ctrl+f11
and this seems work well with python run configurations too.
But... What if the last thing I ran was a Java program, but I now want to run the active .py file? Previously, to run the .py file, I'd have to go digging through the buttons on the toolbar with the mouse, and I tend to prefer keyboard shortcuts...
Solution! So, finally I come to the actual useful bit of this answer - I just discovered by accident (typing Ivan's suggested shortcut, but missing!), it appears that
f9
will run the currently active python file.
Hope that helps someone get just that little bit faster...
I use CTRL+SHIFT+F9 to relaunch the previous debug configuration in Pydev.