title: Why won't the VisualVM Profiler profile my Scala console application?
body: <p>I assume the question is strongly related to <a href="https://stackoverflow.com/questions/9296258/why-wont-the-visualvm-profiler-profile-my-application">this</a> one but it is closed and the solution does not seem clear to me.</p>
  
  <p>I am trying to use VisualVM to profile a console Scala application of mine. I do this by starting VisualVM, starting my Scala application, opening its node in VisualVM, going to the "Profiler" tab and clicking "CPU". The button goes grey for some time (while status never changes to anything from "profiling inactive"), then back active but no profiling data appears shown.</p>
  
  <p>The application does some file reading, data processing (which takes about a minute), stdout data output and exits. I've also tried adding <code>Thread.sleep(60000)</code> to the beginning and to the end of the program to ensure enough time for VisualVM to capture it and do the job, nothing changed though.</p>
  
  <p>Unlike to the related question I've linked to I don't launch my app from Eclipse or anything else - I use the following command line to launch it:</p>
  
  <pre><code>java -classpath myapp.jar:lib/* MyApp.Main
  </code></pre>
  
  <p>all the libraries (including <code>scala-library.jar</code>) are put in <code>lib/</code>. The app works as expected.</p>
  
  <p>Updates:</p>
  
  <ul>
  <li>I have tried YourKit Java Profiler 11.0.2 and it fails with  <code>AttachNotSupportedException</code>.</li>
  <li>I've managed with YourKit by <a href="http://www.yourkit.com/docs/95/help/agent.jsp" rel="nofollow noreferrer">attaching the agent manually</a>. </li>
  <li>It seems worth stressing that I neither run the application from an IDE (or a build tool) nor have I modified any JVM options but classpath. As far as I understand this problem appears to depend on a JVM version and user/permission issues and. <em>The objective is to figure out the actual mechanism of the problem and the way to configure all the things to work</em>.</li>
  </ul>
  
  <p>Versions of the software used:</p>
  
  <ul>
  <li>YourKit Java Profiler 11.0.2</li>
  <li>VisualVM 1.3.4</li>
  <li>SBT 0.12.3 (to build but not to run (I've tried both actually))</li>
  <li>Scala 2.9.2</li>
  <li>Oracle Java 1.7.0_04-b20</li>
  <li>XUbuntu Linux 12.04 32-bit i386</li>
  <li>Linux kernel 3.2.0-24-generic-pae</li>
  </ul>