Comments (5)
Can you provide an example?
from pyjnius.
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.
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.
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.
Closed by #24.
from pyjnius.
Related Issues (20)
- pyjnius build error on s390x HOT 10
- ClassNotFoundException for android.media.midi.MidiManager.OnDeviceOpenedListener HOT 3
- unexpected error for jdk17 HOT 4
- Crashes on Apple M1 HOT 27
- How to add everything under M2 repository to pyjnius classpath? HOT 2
- DeprecationWarning: pkg_resources is deprecated as an API
- pyjnius build error, still coming HOT 10
- Including a JAR on Android HOT 2
- Support mail address is broken HOT 2
- OverflowError: value too large to convert to jshort HOT 4
- How to create Webview with FileChooser HOT 1
- Moderinze `java` code? HOT 2
- installation documentation could be refreshed HOT 3
- Usage without JDK HOT 6
- AttributeError: 'Class' object has no attribute '_JavaClass__cls_storage' HOT 4
- Running python script on Android but in Docker container HOT 1
- Getting a pointer to JavaVM
- Dependency Dashboard
- No jvm.dll found HOT 3
- Unrecognized option: --add-exports / --add-opens HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyjnius.