Is there a way to know which java package a class is related to through a line of command? For exemple, I would like to print out the package of the class Integer which is java.lang.Integer
Thanks
Is there a way to know which java package a class is related to through a line of command? For exemple, I would like to print out the package of the class Integer which is java.lang.Integer
Thanks
Edit : there's a class.getPackage()
method I didn't knew about.
System.out.println(Integer.class.getPackage().getName());
If I understand correctly you want to be able to search for a class using its SimpleName and then print the package name. Or at least print all possible matches (found in several packages).
If this is the case you can leverage the snippet (found here) to create a utility yourself and execute from command line. This might be a bit slow though.