I tried something really stupid but it worked 
Code:
import java.awt.Toolkit;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JFrame;
public class Util {
public static void main(String[] args) throws Exception {
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
final JFrame tempFrame = new JFrame();
tempFrame.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
tempFrame.dispose();
}
public void focusLost(FocusEvent e) {
}
});
tempFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
tempFrame.setVisible(true);
int frameHeight = tempFrame.getHeight();
int taskbarHeight = screenHeight - frameHeight;
System.out.println(taskbarHeight);
}
}