From: Samuele P. <pe...@in...> - 2000-11-09 12:54:56
|
Hi. [Schmidmeier, Arno] > Yes they can be different. e.g. py passing > -Duser.dir=~/something on the commandline of the java VM. > I do not know which should be preferred, but my feeling says me that > "" eqalsto System.getProperty("user.dir")should be preffered. > However there might be a problem is the access to System.getProperty > is restricted or if this property is not defined. > I suggest therefore something like: > > String FileName=null; > try{ > FileName=System.getProperty("user.dir",null); > }catch(SecurityException sec){} > if (FileName==null) > FileName="."; > ... I should admit I had missed these aspects. In any case the expansion happen when interpreting classpath and sys.path, so "." is preferable. But I really worry about what happens on a Mac? Unfortunately I have no access to such a machine and its jvms. [Schmidmeier, Arno] > I do not understand this topic fully, I want to ask is following > scenario possible: > I have a java-package X with classes a and b. > on the classpath (sys or jython) there are two distinct entries > j1.jar and j2.jar. > j1.jar contains a and j2.jar contains b. Is this possible? > Same for .py filesand directories. The semantics for py modules will remain as in python, if one not plays with __path__ a py packages span over just one directory and its subdirs. sys.path can contain only dirs (an extension for allowing zips and jars should be not too difficult but it depends on what happens on CPython side and for the moment I like to see what happen with the patch and get rid of old and (hopefully few) new bugs, extending things should be easier with a clean (so I hope) codebase. The support for relative imports inside py pkgs should work as in CPython. This should still be fixed in jythonc. Concerning java with the patch: * classpath is virtually extended with sys.path classpath take over sys.path. * py pkgs take over java pkgs, but the java classes in the shadowed pkg can be accessed through the py package * dir and from import * for a java package now should really consider the union of everything that's is in the dirs/jar on classpath and in the dirs on sys.path. regards, Samuele |