In Python you can get the path of the file that is executing via __file__ is there a java equivalent?
Also is there a way to get the current package you are in similar to __name__?
And Lastly, What is a good resource for java introspection?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
this.getClass() = current class
this.getClass().getPackage() = current package
Class.getName() = string of class name
Package.getName() = string of package name
I believe you’re looking for the Reflection API to get the equivalent of introspection (http://download.oracle.com/javase/tutorial/reflect/).