Is there a way to create/generate R.java and resource folders in a non-Android project, such as in Java?
A great place to start looking would be into the aapt tool. This is the tool that creates the R.java class.
http://elinux.org/Android_aapt