Page 1 of 1

HELP - No way to find a Java class from AS extension

Posted: 02 Dec 2010, 19:07
by Pippoflash
Hi,
I have tried in any way, but I always get the same error:
21:28:44.595 - [ WARNING ] > Error in extension [ _pippoExt.as ]: TypeError: [JavaPackage test.SimpleClass] is not a function, it is org.mozilla.javascript.NativeJavaPackage. (_pippoExt.as#1580) Internal: 5 -- Line number: 4 in file: _pippoExt.as

Here is the scenario:
- I created a java class called SimpleClass which lives in the javaExtensions/test/ folder.
- The class works, and it can be correctly instantiated from a java extension, but I do need to instantiate it from an AS extension.
- Path has been added to start.bat (both path to the folder containing .class file, and I tried also creating a .jar and adding the jar)

In the AS extension init() :

var test = Packages.test
var c = new test.SimpleClass()
trace("Hello from the Simple Extension Example!"+c)

I am going nuts.
There is no way to have the AS see the java class...
can anybody help?

thanks
F

Posted: 03 Dec 2010, 04:22
by BigFIsh
Your code snippet looks file to me.

Not sure what could be wrong. Could be due to invalid path definition or bad placing of .jars.

So, try start again from scratch using the following example as a guide. http://www.smartfoxserver.com/docs/docP ... /index.htm.