Suppose I want to create a Java object from string.
Object obj = Class.forName("com.my.object.MyObject").newInstance();
I was able to create MyObject. My question is how can I create a Java built-in object such as Long or String from string. I need to do this because I can only know the type of object in run time in text format.
I did this but didn't work.
Object obj = Class.forName("java.lang.Long").newInstance();