A good Java Tool to monitor the heap - java

I have been searching, and see that there is Jstat, VisualJVM, and even Eclipse mat tools, but they all seem to have the JDK needing to be installed.
I have a third party tool used in my .NET application (separate server instance) that has a JRE installed with it. I don't have the JDK or any Java code, but can't seem to find a tool (like windows task manager), to monitor the Java heap.
Any good (and free) suggestions, with details on why its great, would be helpful.

The eG Innovations Java Monitoring tool - http://www.eginnovations.com/web/java-monitoring.htm

Related

Memory leak in native java aplication

Hi all!
I have a Native Java application in linux and i want detect memory weak. I try used Valgrind but seem that don't work fine. Then I tried to also install dbx (Oracle Studio) but it seems that is not available for Ubuntu 14.04. Is there another solution that can be used to detect these leaks ?
In my opinion, the best tool you can use to detect memory leaks and performance problems is JProfiler
You can easily detect both of them and it has integrations with a lot of IDEs (Eclipse, STS, Netbeans, IntelliJ, etc...).
It's not free, but you can request an evaluation key to test the tool for about 10 days.
Eclipse MAT is a good tool to analyze memory for Java applications. They have good documentation for common use cases.
A similar question was asked here

Profiling for java in eclipse juno

I have to optimize performance of a team project (in eclipse Juno).
To identify the bottle neck (timing) i'm searching for a tool or plugin.
There seems to be a good platform TPTP, but this is not supported anymore in Eclipse Juno.
JVM is a good start but seems not sufficient for a deeper analysis.
Did you have some good pratices for an integrated Plugin in Eclipse Juno?
If not maybe some standalone tool is succiecent as well.
There are several big solution in Java profiler world:
JProfiler
YourKit
JVisualVM, (Standart Oracle JDK tool)
JProfiler and YourKit are powerful tools for analyzing big EE application. Personally I most prefer YourKit. It has easy intergation with Eclipse. But it all is paid solution and not always you need to buy this one.
If you has not very complex application try to use JVisualVM at first. It should be enough to wide range of performance problem analyzing. To monitoring GC behavior it has great VisualGC plugin. With VIsualGC plugin, making heap dumps and analyzing it with MAT you are able to perfectly tune GC if you need.
I am a big fan of JProfiler and it has a Eclipse plugin too.
In this SO post you can find how it works.

Which is the definitive profiling tool for Eclipse 3.7?

I've just started using Eclipse 3.7. Previously with Eclipse 3.6 I used a tool called TPTP for execution-time profiling (It could do a lot else besides this, but that's all I needed it for).
I note that TPTP has now been sidelined, it's no longer an active Eclipse project.
Is there a new project which replaces TPTP? There does not seem to be an equivalent tool bundled with Eclipse, so I'm wondering which is the default go-to free profiler for Eclipse 3.7?
Extra points: The class I'm profiling makes use of a lot of JNI calls. I'm not expecting to get any meaningful insight about what happens in these native calls, but I do not want the fact that I use native calls to break the profiller. For some reason TPTP on Eclipse 3.6 couldnt handle this at all!
i m working with this tool:
http://code.google.com/a/eclipselabs.org/p/jvmmonitor/
Bye
If a commercial solution is an option for you, I can recommend
http://www.yourkit.com/
or
http://www.ej-technologies.com
Although the latter made my VM crash on OSX, when I last tried. Fortunately, there's a fully working trial version...
You can try VisualVM (is not an Eclipse tool, is included into the JDK 6 Update 7 and next)
You can use JVM Monitor, which is a free Eclipse plugin in pure Java.
https://code.google.com/a/eclipselabs.org/p/jvmmonitor/
It lets you monitor JVM applications, doesn't require any special launch configuration or preparation, and uses standard JVM APIs to connect and monitor. For me it just worked moderately OK, right out-of-the-box.
It includes profiling, targets your specified packages & includes 'total time' and call trees for method profiling. These were what I needed & couldn't get with JVisualVM.

Best OS for java development? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is the best OS for Java development? People from Sun are pushing the Solaris, yes Solaris have some extra features included in itself such as (dTrace, possibility for Performance tuning the JVM, etc.. ). Some friends of mine, had port their application on solaris, and they said to me that the performances was brilliant. I'm not happy with switching my OS, and use Solaris instead.
What were your experiences?
Of the three I've used (Mac OS X, Linux, Windows), I consider Linux the best place to do Java development.
My primary personal machine is a Mac, and I've done quite a lot of Java development there and been happy with it. Unfortunately, however, Apple lags behind the official JDK releases and you're pretty much limited to the few versions they choose to provide.
My employer-provided machine is an old P4 crate from HP which I use mostly to keep my feet warm. The real work occurs "Oberon", on a 2.6 GHz quad-core running Ubuntu 8.04 in 32-bit mode [1]. The two advantages I notice day-to-day compared with Windows are:
A powerful command line, which helps me automate the boring little stuff.
Far superior file system performance. (I'm currently using EXT3 because I'm becoming conservative in my old age. I used ReiserFS previously, which was even faster for the sorts of operations one typically performs on large workspaces checked out of subversion.)
You can get those advantages from a mac too, but Linux offers another nice bonus:
Remote X11: Before my $EMPLOYER provided e-mail and calendar via web, I had to be on the Windows box to read my mail and see my meetings, so I used Cygwin's X11. This allowed my to run the stuff on Linux but display it on my windows desktop.
[1] I used to run Ubuntu in 64-bit mode, but I had no end of trouble. (Mixing 64-bit and 32-bit is something Mac OS X does much better.) 7.04 worked fine running 32-bit applications on the 64-bit kernel. 7.10 broke the linux32 script and the ability to install new 32-bit applications though old ones continued to (mostly) run. 8.04 killed 32-bit java by making it impossible to connect to the network from a 32-bit JVM (no more updates for Eclipse). Running Eclipse 64-bit didn't work reliably. The then current version of oXygen would only run (grudgingly) under the IBM 64-bit VM which would work for about 10 minutes until it stopped getting keyboard events. I finally gave up in frustration and used my Mac for a few months until I had enough slack time to do a 32-bit install of 8.04 on the linux box. Now everything works again and I'm quite happy.
Develop on whatever you like. As a java programmer you might want to avoid Mac OS X, primarily because new features seem to have been significantly delayed, and also because you can find you've no longer got a machine that supports the new versions of Java. Having said that I imagine developing on Mac OS X must be very nice (command line interface, dtrace, nice OS).
I develop on windows with IntelliJ 7. It's ok, but needs some hefty hardware. I then deploy onto solaris/linux. Unless you're writing GUI's or integrating with C++ code, you should be fine choosing whatever takes your fancy.
I'd say Mac OS X.
Java development built in. All the unix command line tools you want. Out of the box. Ant and maven are there. Not the latest versions, but that's easy enough to upgrade.
Yes, you might not have the very latest version of the JDK, but really, unless you have a need to develop for the latest and greatest JDK, it's not going to be an issue.
"development" ?
I believe you should stick to the OS you are the most comfortable with, or which is the most available to a large group (of developers), like for instance a set of PCs on Windows.
It is rare to need to do in-depth tuning on development platform.
You would reserve all those dtrace and other performance tuning to assembly platform (for example in Linux), for daily deployments where everything is recompiled and unit-tested.
And then you could set up a special JVM (like IBM JRockit instead of Sun JRE) to do some analysis on your integration platform, where all your system can be tested from front to back, with stress and non-regression test
And finally, make all UAT (User Acceptance Tests) on a pre-production platform (which can be an expensive F15K or SunFire880 or V490 or...), with the target JRE used there.
My point is: there is so many parameters to take into account between development and release into production that switching OS at such an early stage may prove unnecessary.
Develop on what you're happy with, and test on what you deploy on.
I get to develop Java on my Mac, and deploy on Solaris and Linux. The truth is that for the bulk of tasks, Java can be developed in an OS independent manner. This is especially true for server side development.
I like developing on a Unix in general over a Windows box, but that's me.
Answer is easiear than you might think: use your favorite OS. For Java, it's the best answer. Not the development itself, but your comfort will help your success, browsing docs etc in your favorite environment.
Personally, I would not bother. I would use the platform that best supports the development tools and target platform that you use.
Why do you need to tune the JVM? This is a very unusual thing to want to do. Would you be better writing in a lower level language like C++?
Dtrace is available for OS X, there is a linux port too.
Solaris has historically had a reputation for being slow (hence the Slowaris nickname). I'm not sure if this is still true.
I've used Linux, Windows and OS X. My big argument in favour of OS X is that it is user friendly operating system (ie. I can run iTunes, most modern browsers, and don't need to allocate 50% of my time maintaining it on a laptop like linux) with a unix foundation. As most my development is for unix systems, this makes life hugely more productive. Also, there is a more and more active development community behind the platform here. These reason also work in reverse for Windows - while cygwin closes some of my requirements for using unix tools - it's nothing like having a real unix system.
I have had success before doing Java development in Windows with Eclipse. Sounds like you are also asking about deployment/hosting. Whichever OS is best to run your application on should not really predicate what OS you use to develop the application.
Windows and Eclipse works well, as pmiller suggested. I can also recommend OS X with either Eclipse or IntelliJ IDEA (the latter also works on Windows, too).
I've only ever done the most basic Java development on Solaris (basic data structures' programming practice at University), so I can't offer any real comparison, I'm afraid. I did find it quite painful on Solaris, though, due to a lack of proper tools (I think I was restricted to nedit or something).
One thing you have to take into account is whether you are going to be developing an application that could be run on a mac. I love OS X, but good old steve made sure that we're always many JDK versions behind. We just barely got Java 6. Developing on a mac may at least insure you are working under the lowest possible JDK version.
Your development environment MUST BE THE SAME AS PRODUCTION.
There is no "best development environment" which is not identical to your production environment. Run what you run in production, in development.
That said, that doesn't mean you can't run your IDE, for example, on another OS, provided you still do development on the same system as production (on another machine, or a VM, for example).
Windows is just fine.
Solaris is a wonderful Java development environment too (I like it better than Windows, but for subjective reasons), but unless you're deploying on it, it might not be worth switching to.
Linux is a little clunky for Java development, but doable.
The only one I can't recommend is Mac because they're always so far behind on the version of Java available (Not provided by Sun, Apple does their own).
My best advice is to develop on the platform that you are targeting. That way, when you run it during you development testing and run your unit tests, you know that it will work on the target platform too, without any nasty surprises.
If you are targeting all platforms then you might actually want to develop on a Mac because you will get the most nasty surprises on the Mac. As far as Java goes, on Windows and Unix, "it just works", but not so much on Mac. Sun develops the Java runtime (JRE) for all operating systems except Mac. Apple develops their own JRE.
If you develop on the Mac, you are most likely developing against the least common denominator, so what runs on Mac should run on the others. That has been my experience.
Barring that, I always recommend that you choose the operating system based on whether it runs your software. Pick the OS that runs your IDE and other tools that you use for development and testing. If more than one OS runs the tools that you need, pick the one that runs them the best.

Linux distros for Java Development

Simply, are there any Java Developer specific Linux distros?
A real Sun geek would chime in here about the virtues of using Solaris as a Java development platform, but I am much more ambivalent. Developing with Java is about the same on any linux distro; you are going to wind up having to install the JDK and tools of your choosing (Eclipse, Sun Studio, Tomcat, etc) so you may as well choose a distro on other criteria... perhaps how comfortable you are with it, how easy package management is, and if the look & feel suit your development habits are all big factors.
So, to answer your question more directly, a Java developer would do well with any major linux distro that they are comfortable with using in general. If you want some Java goodness out of the box, Fedora 9 and Ubuntu 8.04 have OpenJDK (and NetBeans) according to a recent announcement.
Dont listen to any of these noobs suggesting one distro over another. Java is Java and just about all distros can install java as such:
[package manager command to install] jdk
If the question was about creating RPM's, then obviously RH/CentOS/Fedora would be desirable over deb distros, source distros, or whatever other format you love. However, due to the nature of Java, a specific distro to use is only relevant if the OP cant formulate their own opinion and must follow whatever other people are doing.
To reiterate There is no java distro , use whatever will have you hit the ground running.
// begin hypocritical personal recomendation
... that being said ... I personally use Archlinux. Archlinux works on rolling releases so it is more likely to have a more recent JDK version then the "sudo apt-get dist-upgrade && sleep 6 months" distros of the world.
// end hypocritical personal recomendation
Also, I am fully prepared to get downvoted, but please, leave me above 50 so i can comment still, thanks!
Solaris :)
On a serious note, there is no Linux distro dedicated to Java, so it would be about the same.
OpenSolaris on the other hand (in my very humble experience) would be a bit faster, and you would have bonus of Dtrace as a tool. (Not that you can't find similar tools in Linux, but Dtrace should be somewhat more advanced).
I am very heavy into Java development and I personally use Ubuntu, so I agree with Sean on this one.
The package manager allows you to easily install the various SDKs (the SUN one, or even the upcoming OpenJDK 7).
Regards,
Arjen
I have used Ubuntu 8.04 and Fedora 9 with success.
For Ubuntu, the community forums were very helpful and if I remember correctly one of the repositories provided apt packages for Sun's Java6 distribution.
On Fedora 9, the Sun rpms work alright.
In either case, alternative/galternative is your friend to make sure that you point "java" and "javac" at the Sun install. I've been using Netbeans 6.1 and Eclipse 3.4 both on Fedora 9_x64 with no problems.
Just be careful with your distro's java installation. Most install gcj by default. For whatever reason, typing "java" into bash on most linux distros will not invoke a Sun JVM without some futzing.
Usually, there needs to be a bunch of soft-linking from /usr/local/bin -> $JDK_HOME/bin/* to get things working as I typically expect them.
I think the motive for this question is focused on the convenience of setup: Is there any distro that has Eclipse and the full Sun Java package (JRE, JDK, and DOCS) already "baked in" so that a manual install process (and deinstall of OpenJDK) is not required?
Having an "out-of-the-box" standardized environment for a development team is a huge time saver. If you don't already have access to a Java-experienced Linux SysAdmin to guide you through the process of rolling your own automated install, learning enough to do it yourself is definitely frustrating.
Few Developers enjoy spending their time wrenching around with OS internals to get tools like Glassfish, Derby, Groovy, Grails, GWT, etc. all working together. They prefer to go directly to writing code and inventing stuff inside a personal sandbox that exploits a pre-existing ecosystem of built-in services...
On the deployment side, having a common Linux install that requires no system-level configuration for end-users except for installing their favorite Java applications' .JAR file would be another big win.
There's definitely a market for someone to provide this, but most folks are simply gritting their teeth and doing it for themselves.
Either SUSE or RH, both have official support.
http://www.java.com/en/download/help/5000010500.xml
I have never heard of a Java-developer-specific Linux distro.
If you need a Linux distro for work purposes (not for personal home use) then the choice of distro is not really affected by the fact that you need to install a JDK, but other factors:
how quickly can it be installed?
how easy is it to maintain (updates etc)?
how fully-featured is it out-of-the-box?
how well supported is it? (commercial support if you need it, otherwise how good is community support?)
My suggestions for work-purposes: Ubuntu and Suse have been good for me. I have no experience with the others mentioned (eg: Fedora).
Basically, get a distro that "just plain works". Everything you need (JDK, IDE, etc) will almost certainly be easily installed from there.
I had a pleasant experience with Mandriva power pack 2008. Select something like development->"java tools" and everything is installed for you.
Everything being Sun JRE, JDK, and eclispe.
Solaris did install a 64bit kernel by default though.....
Latest Ubuntu version. It is easy enough and have packaged Sun Java, Eclipse, NetBeans, GlassFish, TomCat and other Java development related software so you have no worries installing and configuring it from scratch.
You can choose any of the distro available bcoz dere is no linux distro specifically for java development. Personally I have worked on RHEL 5, Fedora 9, Mandriva with considerable success.
Working on java is same on any linux distribution after the installation of jdk, tomcat, eclipse, etc.
As Nick Stinemates mentioned, Gentoo is an excellent distro for developing Java. It is one of the few Distros that I know of that has a very active Java maintainer group and almost everything that people use regularly is already packaged.
Be warned, Gentoo is not a drop dead simple distro to use Ubuntu -- you have to understand a bit about how the OS works -- but it does provide an excellent developerment environment.
The distro which is most developer friendly, in my opinion, is Gentoo. Since you compile everything from scratch, you choose exactly what makes up your system. Java can be installed very easily, so you could potentially just have a window environment and Java installed (aside from the standard tool chain.)
For a start: most -if not all- linux distribution allow you to "easily" install (that is: using the distribution's package manager) jdk's and jre's. The choice essentialy is more about what aspect of the distribution is most relevant to your personal taste.
Personnaly, I've come to value overall distribution stability (as in: upgrades to the base system are more or less guaranteed-not-to-hose-my-workstation-one-day-before-delivery-date) more, which made me stick with debian for the past few years.
The price to pay for that is either "sudo apt-get dist-upgrade && sleep 6 months" as theman_on_vista points out, or just install relevant stuff yourself in /opt. After all, installing some jdk's, maven or ant and eclipse|netbeans is easy enough (hell, there even is documentation somewhere I'm sure :) )
Oracle JVM from their website is going to have the same speed on debian, archlinux and slackware (and probably their derivatives). Your best bet is to tweak the JVM arguments for the web servers/IDEs you might be using. Remember that java for x64 architectures will consume more memory due to larger native pointers, so you would do well to tweak your heap size accordingly. Especially if you don't want your server to stop with an OutOfMemoryError exception.
if you use ubuntu or other debian family you can try this command
sudo apt-get install default-jdk default-jre
While not really a distribution, there is a virtual machine available for Tomcat. It could be adapted pretty easily for other Java based deployments (available for several virtualization technologies).
There are also several Java App Server VMs available from VMWare (VMWare only, of course).

Categories