Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So I'm curious:

I've implemented Lua within C++ a few times before, and while it was relatively simple, it still didn't harness the power that I would have liked.

I love how eclipse works, including javadoc locations, etc. and I was wondering if there was a way to integrate Java into a native application (that is cross-platform, of course) to do what Lua does, but with Java.

This means I'd be able to build my own base classes and stuff, etc.

Just an interesting thought! Any insight?

EDIT: Also, what about MonoDevelop? Is it relatively easy to integrate? Is it compiled? Is it cross-platform-able?

share|improve this question
1  
I very much doubt a language designed for a freestanding virtual machine rather than for embedding (as Lua) will do great at embedding. That's not to say it's impossible, but chances are it will be very painful. –  delnan Feb 8 '12 at 18:40
    
yea I figured. I just love the ease of inheritance that java has. –  Qix Feb 8 '12 at 18:44
    
Do you want to integrate C++ and Java or Java and Lua? –  World Engineer Feb 8 '12 at 19:09
    
C++ and Java, much like how you would integrate C++ and Lua. –  Qix Feb 8 '12 at 19:13
add comment

1 Answer

up vote 3 down vote accepted

As someone mentioned in the comments, hosting Java within a C++ app would be difficult. You'd have to provide an environment for it to run in. It's not outside the realm of posibilities though. For example, the mono project has IKVM with is a .NET implementation of the Java Virtual Machine. This allows Java and .NET code to run together. Look at the sources of IKVM to get a grasp of the magnitude of making such an effort with C++.

There is a similar project called Junc++ion but I don't have any experience using it. One of the features they highlight is a shared JVM which forgoes the necessity to have a separate JRE installed on the machine. From the looks of things though, it only supports invoking Java code from C++ not the other way around.

share|improve this answer
    
Interesting, I'll have to check it out. I was planning on using Lua for this particular project, but if I can get Java working (well) then I might give it a shot. –  Qix Feb 8 '12 at 19:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.