Giter Club home page Giter Club logo

Comments (5)

apalala avatar apalala commented on August 28, 2024

Can you provide an example?

from pyjnius.

imd avatar imd commented on August 28, 2024

Sure. Here are two sessions, one using PyJNIus and the other using Jython:

$ echo $CLASSPATH
/usr/share/java/postgresql-jdbc4.jar:/home/ian/Applications/mondrian/lib/*:
$ python
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from jnius import autoclass
>>> System = autoclass('java.lang.System')
>>> System.getProperty('java.class.path')
'/usr/share/java/postgresql-jdbc4.jar:/home/ian/Applications/mondrian/lib/*:'
>>> ^D
$ jython
Jython 2.7a2 (default:9c148a201233, May 24 2012, 15:49:00) 
[OpenJDK Server VM (Sun Microsystems Inc.)] on java1.6.0_24
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.lang import System
>>> System.getProperty('java.class.path')
u'/home/ian/Applications/jython2.7a2/jython.jar:/usr/share/java/postgresql-jdbc4.jar:/home/ian/Applications/mondrian/lib/commons-collections.jar:/home/ian/Applications/mondrian/lib/commons-vfs.jar:/home/ian/Applications/mondrian/lib/servlet-api.jar:/home/ian/Applications/mondrian/lib/derby.jar:/home/ian/Applications/mondrian/lib/retroweaver.jar:/home/ian/Applications/mondrian/lib/junit.jar:/home/ian/Applications/mondrian/lib/dom4j.jar:/home/ian/Applications/mondrian/lib/hsqldb.jar:/home/ian/Applications/mondrian/lib/xml-apis.jar:/home/ian/Applications/mondrian/lib/xercesImpl.jar:/home/ian/Applications/mondrian/lib/jsp-api.jar:/home/ian/Applications/mondrian/lib/asm-util.jar:/home/ian/Applications/mondrian/lib/javacup.jar:/home/ian/Applications/mondrian/lib/backport-util-concurrent.jar:/home/ian/Applications/mondrian/lib/commons-dbcp.jar:/home/ian/Applications/mondrian/lib/eigenbase-resgen.jar:/home/ian/Applications/mondrian/lib/mondrian.jar:/home/ian/Applications/mondrian/lib/eigenbase-xom.jar:/home/ian/Applications/mondrian/lib/asm.jar:/home/ian/Applications/mondrian/lib/xmlunit.jar:/home/ian/Applications/mondrian/lib/commons-math.jar:/home/ian/Applications/mondrian/lib/olap4j.jar:/home/ian/Applications/mondrian/lib/xalan.jar:/home/ian/Applications/mondrian/lib/asm-tree.jar:/home/ian/Applications/mondrian/lib/olap4j-source.jar:/home/ian/Applications/mondrian/lib/eigenbase-properties.jar:/home/ian/Applications/mondrian/lib/commons-io.jar:/home/ian/Applications/mondrian/lib/retroweaver-rt.jar:/home/ian/Applications/mondrian/lib/asm-commons.jar:/home/ian/Applications/mondrian/lib/commons-lang.jar:/home/ian/Applications/mondrian/lib/log4j.jar:/home/ian/Applications/mondrian/lib/olap4j-xmla.jar:/home/ian/Applications/mondrian/lib/javacc.jar:/home/ian/Applications/mondrian/lib/validation-api.jar:/home/ian/Applications/mondrian/lib/commons-pool.jar:/home/ian/Applications/mondrian/lib/olap4j-tck.jar:/home/ian/Applications/mondrian/lib/commons-logging.jar:/home/ian/Applications/mondrian/lib/jlfgr.jar:'
>>> 

By the way, here's the OpenJDK code and documentation for doing the expansion.

from pyjnius.

apalala avatar apalala commented on August 28, 2024

OK. A couple of days ago Jnius used '.' as the classpath, which made it impossible to use classes different from the ones in the Java standard lib or system installs (I use Ubuntu). I looked at the man page for the java command, and added a couple of lines to pick up the classpath from the environment variable. The documentation for java said nothing about wildcards, but the feature should be very easy to add using the glob module. (BTW, I just realized that the code I added doesn't look for a ';' separator when running on Windows.)

from pyjnius.

imd avatar imd commented on August 28, 2024

If using the glob module, be aware that * shouldn't expand into all files in the directory, but only all files ending in .jar or .JAR, as described in wildcard.c.

from pyjnius.

KeyWeeUsr avatar KeyWeeUsr commented on August 28, 2024

Closed by #24.

from pyjnius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.