Unfortunately, this solution breaks RLink, so it cannot be safely used in a package after all.
This was answered by @WReach on StackExchange. Please read the answer there:
I forgot to mention that my motivation for using J/Link is accessing the clipboard: http://community.wolfram.com/groups/-/m/t/1048735