I make singleton class and use this class object in different class this code work fine in eclipse but when i make runnable jar than it take empty hashmap list i don't know why my code...
My singleton class
public class PointCalculate {
public HashMap<String, Float> calPoint;
private static PointCalculate instance;
private PointCalculate(){
calPoint = new HashMap<String, Float>();
}
public static PointCalculate getInstance(){
if(instance==null){
instance = new PointCalculate();
}
return instance;
}
public void calculatePoint(String uid ,float point){
Float ps = instance.calPoint.get(uid);
if(ps==null) {
ps = point;
instance.calPoint.put(uid, ps);
}
else {
ps = point+ps.floatValue();
instance.calPoint.put(uid, ps);
}
}
}
and i am passing value from this class below....
public class Exp {
public void setpoint(){
PointCalculate obj = PointCalculate.getInstance();
obj.calculatePoint(rowkey, point);//rowkey and point come from file.....
}
}
now i am passing hashmap....
public static void main(String args[]) throws Exception {
PointCalculate obj = PointCalculate.getInstance();
SqlInsertPoint.givePoint(obj.calPoint);
}
but in SqlInsertPoint.givePoint() hashmap list will be empty i don't know why if any body know than help me Thanks in advance