Tomcat applications won't enter debug through intellij on OSX - java

I am following this book Wrox Java for Web Applications
I have Tomcat 8 set up on my macbook pro which is running OSX Mavericks. When I ever I set a break point in Intellij it just gets ignored. I tried the same in Eclipse and it worked.
I really like Intelij so if I could get it working that be great. Does anyone have any suggestions as to what could be in the issue? I am using Intellij 13.
Thank You

If you're launching Tomcat from IntelliJ then make sure that you launch it debug mode, otherwise breakpoints won't work.
If your Tomcat is external then you can add this to the JVM parameters to enable debuggers to talk to it: -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y

Related

How do I enable java linter when I am using VSCode? It isn't working now

I can't figure out how to enable the linter (red error underline) whenever I use the code editor. So far I have tried enabling other Java linter extensions and re-installing vscode, but no luck. I am currently running v1.28, and my only extensions are the ones in the Java Extension pack.
Side Note:
I encountered is a popup saying "Java runtime could not be located", prompting me to install to install the jdk. I'm not very experienced with vscode and java so I am not sure if this is the error. If anyone has any potential solutions please let me know! Thanks.
You should install jdk on your os , and if you done before , set path in your environment variables.
Make sure the jvm works correctly on your os after installing with this command :
Java -version
Download jdk from here :
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

How can i start my Tomcat 8 in Debug mode which is Installed in "C:\Program Files\Apache Software Foundation\Tomcat 8.0\"

My Project is in Eclipse Helios and I have to run my application in Tomcat 8,
The problem is Eclipse Helios is an older version so It is not supporting to set up Tomcat 8 in servers tab of Eclipse.
I am facing lot of issues while developing and testing, so I am willing to start Tomcat 8 in debug mode can any one please suggest me in this regard.
My goal is to start tomcat in debug mode without Setting it up in eclipse and I should be able to debug my application, I tried in multiple ways but unable to solve this issue can any one please suggest me in this regard.
Regards,
Nithin.
** Copied answer **
With the tomcat6.exe version you can enable remote debugging by running the tomcat6w.exe application and adding the following 2 java options in the list on the Java tab:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
This is according to http://wiki.apache.org/tomcat/FAQ/Developing and it worked in my case (Tomcat 6.0.26 for windows)

How to run java 8 applets with java7u60 plugin?

I'm on clean install Windows 8.1 and I'm trying to run the java 8 example applets provided by oracle.
I've:
Downloaded jdk8 x64 (which installed the jre8 also)
Tried to run the applets, but then had to follow the link to install the latest plugin (java7u60) ( I didn't install the 7u60 jre, just the recommended plugin).
It is verified on the java verification page
I now have JDK 8, Java 8, and Java 7u60 as installed programs. Which I think is what is causing the problem.
Tried again and got them blocked by security settings
Went to control panel>java control panel and changed to medium setting
Tried again and got block by security settings again, they are being reverted as soon as I try to run an applet.
Found https://www.java.com/en/download/help/javacpl.xml and tried it, but they still revert when I try to run an applet.
Tried to run jre8/bin/javacp.exe directly as administrator, didn't help either.
Any help on what my next step is? I can't find a java 8 plugin for chrome or firefox so how are they suppose to run the example java 8 applets without it?
Thanks

Android Eclipse Exit Code=15

I accidentally closed eclipse when I was sending my application to run on my phone, and when I went to open it I got the following error:
Java was started but returned exit code= 15
C:\windows\system32\javaw.exe
Dogsi.requiredJavaVersion=1.6
I have tried restarting my computer but it didn't change this message. I have been using eclipse for a while, and have never seen this error before.
How can I resolve this error?
EDIT:
I ended up just reinstalling eclipse.
It sounds like eclipse didn't get a chance to save its configuration properly while quitting, and now the configuration is invalid when attempting to open.
Please see https://stackoverflow.com/questions/18059686/jdk-error-while-running-eclipse-on-windows-7 and Running Eclipse on Windows 7 JRE and JDK not found . Alternatively, just reinstall the jre and ecipse, but if you don't want to do that, then you're going to have to fiddle with eclipse configuration.

Why isn't VisualVM showing all the normal tabs?

Usually I see all these tabs in VisualVM for locally running Java programs:
However, I have one local program which is currently only showing me Overview and Monitor (even though it usually shows all those shown above):
Also interesting is that VisualVM itself doesn't present the Profile tab:
All three of the programs shown are running with the same JVM with the same Java Home.
What controls which tabs are shown for a particular program? How can I get them all back for my program showing just Overview and Monitor?
I have Visual VM 1.3.5 (latest at this date) and JDK 1.7.0_17.
I found that this was the issue of usage of wrong JDK version. In my case my application was running on 64bit JDK and I started VisualVM from 32bit JDK.
After starting VisualVM from the same JDK on which my application is running, everything was fine. Hope it will help you.
You might need to enable jmx ports on your app. Try adding these switches to your VM and see if the tabs appear again:
-Dcom.sun.management.jmxremote.port=6789 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
I've just removed ~/.visualvm and reran, See https://java.net/jira/browse/VISUALVM-598
As most of the people mentioned,
The issue was due to the version mismatch of virtualvm and your application.
additionally,
visualvm is bundled in oracle which supports jdk up to 9.
If you are using >9, please make sure you go for another profiler.
What worked for me was specifying the "Start profiling from" classes. If I left this blank, I didn't get the profiler tab. When I specified it, I did. I should probably note that this was a web application running under Tomcat, so I specified org.apache.catalina.startup.** as the starting class.
Check that proxy is disabled if you are running VisualVM for local application
I had a similar problem with missing profiler tab in VisualVM. I'm using Oracle JDK 1.8 and want to profile web application running on Tomcat 8 (JPA, Spring, Hibernate, Vaadin, etc).
I tried all above-mentioned solutions and many others found on the internet, but unfortunately, none of them solved missing profiler tab issue.
So I switched to Java Mission Control profiling tool (JMC + Flight Recorder) which is a part of standard Oracle JDK (from JDK 1.7 update 40) and it works great.
In my case, the issue was the usage of wrong JDK version. My App was running on jdk1.7.0_80, VisualVm running with jdk1.8.0_162.
Replacing the APP JDK version from 1.7.0_79 to 1.7.0_80 fixes the problem.

Categories