Category: Java

Execute external process from within JVM using Apache Commons Exec library

Executing external command from within JVM often causes problems- be it in terms of the code to write and manage or in the ease of implementation. I had similar requirement in my Major project for my Under Graduate Degree, where in I had to launch a C program from the Java code. I ran into different issues like- the Main thread getting blocked, the GUI freezing, or reading the output streams and so on. Finally I had to give up the idea and stick with launching the external command externally ūüėõ Had I found the Exec library from Apache Commons then, my work would have been lot easier. Anyways better late then never. I will quickly go through how one can use Exec library to launch external programs from JVM- Its a wrapper over Java’s ProcessBuilder, Runtime.getRuntime().exe().

Advertisements

Monitoring and Profiling using VisualVM-1

I executed a simple GUI application which would load the CSV file and parse it and show the contents in a JTable. When the applications started- There was a JFrame, 2 JPanels, a JLabel and a JButton with an Icon. I wanted to monitor the Heap size variations, the number of Classes, Threads details and also wanted to profile the application. So i thought of using VisualVM. The following are the results and snapshots of profiling using VisualVM. Note that the application had only one public class MainFrame in gui package. Also note that i was using the Nimbus Look and Feel.

JavaFX Important Links

General: JavaFX Homepage: http://javafx.com/¬† OpenJFX’s Homepage: https://openjfx.dev.java.net/¬† The JavaFX Community: http://jfx.wikia.com/wiki/The_JavaFX_Community¬† Useful Links from PlanetJFX: http://jfx.wikia.com/wiki/Tutorials¬† Downloads for JavaFX: http://java.sun.com/javafx/downloads/¬† JavaFX Script Language Support for NetBeans IDE: http://javafx.netbeans.org/¬† JavaFX Technology Screencasts: http://java.sun.com/javafx/screencasts/index.jsp¬† […]