We, Java Programmers, are tired of writing- Getters, Setters, Constructors, and other boilerplate code or tired of reading this boilerplate code. Often the important logic in the class gets hidden due to these boilerplate code. May be in the coming… Read More ›
Java
Synchronizing using method local variables versus the current instance “this”
There was one query which came up on Javaranch– it was related to difference between using synchronized block with a method local variable and current instance “this”. I thought that this would better be explained with a code and I… Read More ›
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().
Using JAXB to generate XML from the Java, XSD
We can use JAXB to marshal the Java objects into XML using the given Schema and vice versa- unmarshal XML into Java objects. The xml schema can be specified in DTD, XSD or other format. The tool “xjc” is used… Read More ›
How coding to Interface and Inheritance helped me reuse code
Before going into the details I will state the requirement: I need to fetch certain records from 3 different tables into 3 ArrayLists. I have 3 Classes which store the information: Lets name it- Class1, Class2, Class3. All the above… Read More ›
Preparation tips for SCJP- Sun Certified Java Programmer Exam
I cleared SCJP 6.0 with 81% on January 25, 2010 (putting this up after a long gap), not a really good score, but happy to get a “PASS” :). I did manage to do some 25 days of preparation (serious… Read More ›
Working with Java Enumerated types (Enums)
In this post I would like to explain about Enums in Java. Though in my 2 years of coding in Java I have seldom used Enums but they do provide a lot of features when we are required to create… Read More ›
Talk @ LBS College of Engineering, Kasaragod, Kerala
I visited LBS College of Engineering, Kasaragod for a workshop organised by thier collegeOSUM Club. This was my first workshop outside NITK. They had suspended the classes for the afternoon so that most of them could attend the workshop. And… Read More ›
How’s Scala different from Java?
Scala is statically type like Java but with Type Inferencing support. Which means that the scala compiler analyzes the code deeply to determine what type a particular value is. In Scala its not required to use semicolons to terminate a… Read More ›
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.