Eclipse debugger not stopping in JUnit Breakpoints in Java 7 - java

I realize there were a bunch of these questions a few years ago. But those problems were fixed an update to Java 6. But I'm on Java 7.
I'm on a Mac OS X, Java 7, everything is up to date.
Things I've tried:
Project Clean
In the debug config, I tried telling it to not run in the background.
In the debug config, tried both running all tests in class and just running a specific test
Double checked jar files and project config
The unit tests DO run, they just don't pause for debugging.
Update:
If I set a breakpoint in the grandparent class SolrTestCasJ4, which is in a second project open in the workspace, AND change the debug config from running a method to run all, it stops near the top of one of my test methods. But it only for an initial breakpoint in the grandparent class. I guess that's an OK workaround for now, but a bit weird and not really an explanation.

It's possible that you're Eclipse instance isn't the one running tomcat. Sometimes eclipse will crash and your server is still running. When you reopen eclipse you can run your tests, but the breakpoints

Related

Intelliji IDEA cannot run single test unless all tests are built successfully

Using Intelliji Community Edition 2022.03 on windows 11, working with Maven 3.6.3 and Java-8.
Been experiencing strange issue: I cannot run single Junit||Blueprint test if that test has problem, the IDE always try to build the whole test file and then failed at that single problematic test. So the situation end up being I have to run all the test successfully in order to run single test. I am sure it is related to my local environment, because my colleges have no such problem we have everything the same. and I also have no such problem in linux VM.
I have tried
install unintall different versions of IDE
Modify test to not build before run, works, but if I change code, no auto detection, so barely
Any wise men got some ideas please ?

Intellij - Debug multiple Maven projects in different windows

Is it possible to open 2 or more projects, in different IntelliJ instances, and debug across them?
For example:
I start debugging on Project A. Project A calls a method in Project B. I want my debugger to continue on Project B on the other window.
I know a way to debug across multiple maven projects, is to add all the projects to the same IntelliJ instance. But I would like to know if there is a way to do it, without adding all projects to the same instance. To break up the projects in its own IntelliJ windows.
Yeah it is possible
First create a remote debug configuration: Edit configuration -> Remote.
You will see a command line argument which you have to copy and paste it to the script that you made to run your java file.
Keep in mind, to make sure your Project B doesnt starting running before your turn your debugger on, change suspend=n to suspend=y.
Once your parent java file runs go to the secondary idea window and run the remote configuration that you created in first step. If everything is right, your code will stop at the breakpoint.

IntelliJ IDEA can no longer run my Gradle run configurations [duplicate]

This question already has answers here:
IntelliJ Build Error Context Mismatch
(14 answers)
Closed 5 years ago.
One of my IDEA installations has stopped running my Gradle run configurations. The run configuration is for a regular Java app submodule in my project (the module is called "server"), and the run configuration is as simple as it can get:
Gradle Project: /path/to/server/build.gradle
Tasks: run
No VM arguments, tool windows or any other configuration.
When I run it, I get this:
with no other output. It is not failing on my other machines that are running the same version of IDEA against the same checkout of the same source repository.
I am running the latest IDEA for OS X, 3.5. I tried downgrading to 3.4, by deleting my 3.5 app and installing 3.4 from scratch, and I got the same error running my configuration.
I have tried (many times) invalidating the caches and removing the out/ directory. When everything is recreated, I get the same error.
I've tried deleting the run configuration and recreating it. Same error.
I've tried creating different Gradle run configurations for other submodules in my project. Same error when I try to run them.
I can switch into any of my submodules and type "gradle run", and they run just fine. It's only in IDEA that they can no longer run.
Update: I edited my run configuration, switched to the Logs tab, and enabled "Save console output to file", sending it to /tmp/idea.txt, and got this error:
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home,daemonRegistryDir=/Users/user3562927/.gradle/daemon,pid=52404,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=ec6aa2e2-e5c9-4857-b08b-1e79fa37a332,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/user3562927/.gradle/daemon,pid=53135,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Not sure why IDEA is not able to show me this information in the "4: Run" pane.
At least I know this is JDK-related now. I've tried updating my JDK in my project structure, and various other remedies suggested on this site, with no luck yet, but I'll keep trying.
I deleted all JVMs on my machine and painstakingly switched my project and module SDKs all over to the sole remaining JDK. No luck.
Then I noticed this little icon in the upper-left corner of the Run pane, which, when clicked, gave me the build output:
It looks like there are garbage characters in my JVM spec. The only place it is defined is in ~/.gradle/gradle.properties, so I deleted that file (even though there were no garbage characters in it). After that I'm back to the "The newly created daemon process has a different context" error.
After trying many many other things, I finally deleted my project's .idea directory and recreated it. This finally made the problem go away.
JetBrains really needs to get a handle on this problem. I had to recreate my dictionaries, my code style settings, etc. The IDE should be handling the presence of multiple JDKs without choking like this.

IntelliJ - How to run current program regardless of errors in unrelative files

I am start learning Scala, I am using
Java 7 and
IntelliJ IDEA 2016.1.4
Build #IC-145.2070, built on August 2, 2016
JRE: 1.8.0_77-b03 x86 JVM: Java HotSpot(TM) Server VM by Oracle Corporation
I got some sample code programs online and trying to run one by one.
But not working, while I try to run, it showing errors in other files but there is no relationship with them, all most all are independent Scala classes only.
IntelliJ Idea, run code regardless of errors in unrelated project files
I followed this similar issue, but I am not able to find options they suggested. like "Make before launch" and other might be very old post.
The option is still there, you just need to look for it in your run configuration window.
As you can see in the below GIF, when you create a run configuration it will implicitly run make before running, and initially it will fail.
The, you edit the run configuration and replace make with make, no error check. If you get a ClassNotFoundException when launching it right after, just re-run it again. I haven't figured out why this happens, it's probably related to how IJ cleans and compiles the classes in this particular case.

Debugging Gradle build files in Intellij / Android Studio

I am sometimes running into obscure problems with Gradle. Sometimes it helps if i am reading the source files or adding println statements to figure out what i can do and what the state is.
But i would really like to just place a breakpoint and list the internal state of variables. is that possible using Android Studio or IntelliJ ?
I would also love to ctrl-click to the DSL keywords so i can get some context.
Just placing a breakpoint and clicking "debug" from the list of gradle tasks does not work, it just runs the tasks without stopping.
You can't debug Gradle files. We may someday implement this, as it would obviously be a great thing, but it's a long ways off. We're in the process of adding more intelligence about syntax highlighting and analysis of build files. Well, actually, JetBrains is adding it to IntelliJ and we're picking it up. This will get better over the coming weeks and months.
Original source
1. Create a debugger
Run -> Edit Configurations
Add New Configuration
Add Remote configuration
2. Open debug mode
$ export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
3. Start debugger
$ ./gradlew someTask -Dorg.gradle.daemon=false #!important, disable daemon mode
4. Attach debugger
Set breakpoints
Start debug
5. Disable debug mode
$ unset GRADLE_OPTS

Categories