New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for High-level API is sparse #80

Open
rhoerbe opened this Issue Apr 15, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@rhoerbe
Contributor

rhoerbe commented Apr 15, 2016

There is a gap between hello world and the more involced code in Weka or othe projects. Where can I find an example how to actually create objects and call methods? My task has fairly APIs, e.g. calling a self-written wrapper class to Xerces to do XML schema validation.

@LeeKamentsky

This comment has been minimized.

Owner

LeeKamentsky commented Apr 18, 2016

The two most useful classes, JWrapper and JClassWrapper are not highlighted that well in the docs. Basically, you use JClassWrapper to get an object representing a class and use it to instantiate objects, call static functions and access static variables:

# Get the java.class.path property using the static call, System.getProperty
javabridge.JClassWrapper("java.lang.System").getProperty("java.class.path")
# Get an instance of a java.io.File and then check if it can be executed
my_file = javabridge.JClassWrapper("java.io.File")("/usr/bin/java")
assert my_file.canExecute()

If a static call or constructor returns a Java object, Javabridge wraps that in a javabridge.JWrapper. If you use the low-level functions, you can do that too.

But you are right, docs are sketchy, so I'll leave this as open.

@deepzf

This comment has been minimized.

deepzf commented Sep 24, 2016

@LeeKamentsky i also need an detailed document too,how to actually create objects and call methods use my own jar package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment