Using Java as an API

Our beginning computer science classes use Java, and it would
be very useful (for potential Blender integration) if students would have
the ability to write Java code which is somehow initiated from
a template Python script. is this possible? This would leverage
the student’s evolving Java knowledge without forcing them to
learn yet another language. For 4th year students, learning Python
is not as muchof a problem, but for entry level students, it presents
a significant hurdle. Thanks
-pf

unfortunately i don’t think thats a possiblity in the near future, you have to remember that java is a compiled language and as such it owul dbe like using C in the text window its not designed to be itnerpreted. you could make a java or c-esque style interpreted languge it would take some time though.

MacBlender

As far as I know, there are 2 free C/C++ interpreters which can run on most of the modern OSes and can be compiled with GCC/DJGPP/VC:
1.Cint covers about 95% of ANSI C and 85% of C++ and is written in ANSI C.
2.EiC can parse almost all of the C programming language.

But I always think C/C++/JAVA language is hard to learn for users like me, on the other hand, Python hides the complexity and let us write clean code efficiently. So I still prefer to strengthen Python in Blender, but not start to add C/C++/JAVA interpreter support except it can run faster than Python obvoiusly

Thanks - Java is of specific interest for us because it is
the language used to teach all Computer Science
majors in most universities, and so any opportunity to
leverage this is welcome. Since “java” is an interpreter
(via the JVM after bytecode is generated), one wonders
whether the java interpreter can then be executed instead
of the Python interpreter and, by using Java code, one
might access Blender’s internal data structures?

Python isn’t bad (except for the inane method of indenting
rather than using a token like a brace or bracket), but if
we can not have to teach two languages, that is even
better from the student’s perspective.

I remember reading somewhere that the JVM can be used as an embedded interpreter, much like the python interpreter. However to do this I bet you would need to use the JNI instead of the C/API and that’s gonna get messy. I also believe the old JVMs had an interactive switch.

It not impossible but it would require ALOT of work to make blender use java as a scripting language. It would be far easier to change python to use something like perl than to use java.

Your other option would be to try to hack blender/python/jython to use jython and get the interpreter to spit out bytecode for a native JVM - but that may not be easy.

Coming from the reverse direction it might also be possible to use the JNI to call python code from the API.
http://www-106.ibm.com/developerworks/eserver/library/es-integratepython.html
but this would be eaiser to do if blender’s python was extended rather than embedded.

It sounds to me like you’d want to use the JVM as an interpreter - and i think it’s doable. You’d have to use some JNI to connect the JVM into blender i think - then you’d prob need a way to wrap functionality using the JNI for the JVM, much like the C/API does.
Potentially you could wrap the existing C/API stuff in a JNI wrapper for exposure… (lol don’t know if this would work or not)

you could, of course, just output all of the variables that you need, import them into java, and then put them back into blender the same way.

python can call executables, so that might work. I am not exactly sure what you are trying to get at.

I’m not certain, but you may have luck going through Jython somehow

No, Jython is a Python running inside JVM, and Blender integration needs it other way around (JVM callable from Python), like here ( http://jpype.sourceforge.net/ )…