I have a Java app running in Google App Engine. I need to programmatically get the ID of the project it's running as part of, in Java.
This question explains how to achieve my goals in Python, but that's not Java of course.
This documentation says that I can simply call ApiProxy.getCurrentEnvironment().getAppId(), but this method just returns null in my app.
This question explains how to get the project ID over an HTTP request, but I'm wondering if there's a better way to do this in Java without having to manually construct an HTTP request?
Edit: Luyi's answer seems like it's working for most people, but it returns null for me.