Your approach to it seems reasonable, although I find myself writing extension modules (for R, PHP, Python, Perl even) in regular old C... not because I particularly dislike C++ or Java, but because if I can get away with just C, it's less likely that I'll step in a template-error or uncaught-exception shitstorm with a 10-page backtrace.
I should have stated this in my comment, but I don't like C++ much (which is why I'd rather use Java over C++). But I absolutely love regular old C. It's a beautiful, simple programming language. I think C is a perfect language for implementing programming languages, libraries and operating system.
I quite like C++. Java is a nice language but is absolute hell to develop iterative web applications with at any reasonable speed. You need a sophisticated in-house division of labour to really use it effectively.
The real danger of the java language is that it's hostile to lean/agile development. If you're in a market that iterates quickly, that can be a real problem. If you work for a bank... less so.
Your approach to it seems reasonable, although I find myself writing extension modules (for R, PHP, Python, Perl even) in regular old C... not because I particularly dislike C++ or Java, but because if I can get away with just C, it's less likely that I'll step in a template-error or uncaught-exception shitstorm with a 10-page backtrace.