Crystal Space
Welcome, Guest. Please login or register.
November 21, 2014, 11:37:58 am

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2046 Topics by 9084 Members
Latest Member: Milnika
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  java scripting plugin
« previous next »
Pages: [1] Print
Author Topic: java scripting plugin  (Read 1380 times)
hedron
Newbie
*
Posts: 5


View Profile Email
« on: January 22, 2010, 08:26:53 am »

Hi guys and gals!

Does anyone know how to register the java script plugin?

I'm trying to get scripting with java working since my CS(1.2.1) won't compile with either python or perl5 (even though they are both found by configure... (another problem with swig!), otherwise I'd be using either of those and poking around in the pysimp example.

I can get crystalspace.jar and libcsjava.so built fine and installed in the right places, I have all the environment variables set up in order for CS to find them, and my code compiles cleanly, but when my code executes:

Code:
        csRef<iScript> java = csQueryRegistryOrLoad<iScript>( obj_reg, "crystalspace.script.java" );

I get the following message:

Quote
crystalspace.pluginmgr.loadplugin:
  could not load plugin 'crystalspace.script.java'
crystalspace.plugin.query:  Couldn't load plugin with class 'crystalspace.script.java'!

I've tried looking through the CS code including csjava.cpp and the swig *.i files, but couldn't find anything that refers to the java script plugin name. I've also read the manual entries for creating and using plugins, but no joy there either. The manual said that plugins require a *.csplugin file, but I couldn't find one in the java script subdirectory (as there is in both the python and perl5 subdirectories). I tried recreating one using the python.csplugin as a guide, but that didn't work.

I'd really like to get this working, otherwise I'm going to have to use jni, and much as I like a challenge (my sanity takes a priority), I would rather keep the solution within the CS framework.

Thanks in advance for any help...
Logged

Her: "I thought you were trying to get into shape?"
Him: "I am... the shape I've selected is a triangle."
Vincent
Full Member
***
Posts: 191


View Profile WWW
« Reply #1 on: February 07, 2010, 11:37:10 am »

Hello

  I don't think you can use the Java bindings that way (from C++), but I may be mistaken since I don't really know iScript.
AFAIK it's only meant to use CS from pure Java programs.
See http://www.crystalspace3d.org/docs/online/1.4/manual/Java-Bindings.html
Logged
hedron
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: February 10, 2010, 01:54:30 am »

Hello

  I don't think you can use the Java bindings that way (from C++), but I may be mistaken since I don't really know iScript.
AFAIK it's only meant to use CS from pure Java programs.
See http://www.crystalspace3d.org/docs/online/1.4/manual/Java-Bindings.html

Yes, I've read the manual several times and it certainly appeares to indicate that CS should be called from Java and not the other way around. However, I've also taken a look through the csjava.cpp code and it appeares to use JNI to call the JVM interpreter to run java code, so in theory, it should be able to be used as an iSCRIPT interpreter.

But, without even having a name for the plugin in order to load it, I can't test that theory.

It would be nice to have a java scripting plugin, since I can't program in Python and have been programming in Java and C++ for years. I suppose I could work on the Lua plugin tutorial (not that I know Lua any better than I know Python), and, of course, there's always the ever-faithful yacc/lex solution.
Logged

Her: "I thought you were trying to get into shape?"
Him: "I am... the shape I've selected is a triangle."
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: February 10, 2010, 12:42:32 pm »

What happens if you run 'jam csjava'? Do you get any errors? That should compile the scripting plugin needed for this to work.

Greetings,
Logged
hedron
Newbie
*
Posts: 5


View Profile Email
« Reply #4 on: February 11, 2010, 01:52:34 pm »

Running "jam csjava" builds crystalspace.jar and libcsjava.so under out/linuxx86/optimize/plugins/cscript/csjava under the build directory, and both are installed under $CRYSTAL/bindings/java when I run "make install".

The CRYSTAL environment variable is set correctly, and LD_LIBRARY_PATH and CLASSPATH are also set properly (i.e. the java test program both compiles and runs correctly).

Unfortunately, I can't give the name of the java plugin to the plugin system in order to invoke it properly in a test application. "csjava" doesn't work, nor does crystalspace.scrypt.java" (as per the python plugin example). I've tried different variations, but nothing obvious has worked.

The plugin system documentation says that all plugins require a .csplugin file associated with it, and that the .csplugin file supplies the name of the plugin (i.e. "crystalspace.scrypt.python", etc) and the python and perl5 plugins each have one, but the java plugin seems to be missing, so I can't determine the name to supply to the plugin system. As i said before, I've tried creating my own .csplugin file, but it doesn't seem to have any effect. I'm wondering it that's a part of the problem, or if the java plugin is intended to be used in a different manner?
Logged

Her: "I thought you were trying to get into shape?"
Him: "I am... the shape I've selected is a triangle."
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 9.2 seconds with 17 queries.