How can I use java reflection or similar to find project name by just having an instance of the class?
If not the project name — which is what I really want — can I find the package name?
How can I use java reflection or similar to find project name by just
Share
Projects are simply organizational tools used by IDEs, and therefore the project name is not information contained in the class or the JVM.
To get the package, use Class#getPackage(). Then, Package#getName() can be called to get the package as the String you see in your code’s package declaration.