From: Niemann, H. <har...@si...> - 2019-05-14 09:21:36
|
Hi Jeff and Stefan, THANKSALOT! calling the interpreter class instead of it's jar file %java32% -cp %CLASSPATH% -Dpython.path=%CLASSPATH% org.python.util.jython diagtest.py works perfectly. The jython.exe --print helped me, too. Mit freundlichen Grüßen Dr. Hartmut Niemann Siemens Mobility GmbH MO RS LM EN CCI1 SRD -----Ursprüngliche Nachricht----- Von: Jeff Allen <ja...@fa...> Gesendet: Montag, 13. Mai 2019 22:18 An: jyt...@li... Betreff: Re: [Jython-users] calling Jython in Windows7: difference between calling jython.exe and jython.jar The class path ought to be ignored (by Java) if you supply -jar. [...] Stefan's solution of putting the Jython JAR on the path and invoking the main program looks good to me. The jython.exe launcher takes a --print option that shows you fairly accurately what it would have launched had you not given that option, and this is a good way to get a prototype Java command line. It is not quite accurate for PowerShell: it seems more elements have to be protected by quoting (e.g. "-Dprop=val"). Jeff Allen On 13/05/2019 19:54, Stefan Richthofer wrote: > It seems that one has to avoid the -jar option (not only on Windows). > Instead, put jython.jar on the classpath and execute the class > org.python.util.jython: > > java -cp whatever...;jython.jar org.python.util.jython someFile.py > > Hope this helps! > > Best > > -Stefan > > Am Mo., 13. Mai 2019 um 20:45 Uhr schrieb Niemann, Hartmut > <har...@si... <mailto:har...@si...>>: > > Hello! > > I have a jython program that uses some in-house java libraries. > > It works if I call it with > > jython.exe diagtest.py > > but if I try to start the jar file > > %java32% -cp %CLASSPATH% -jar > c:\SIBAS32\JAVA_LIBS\jython\jython.jar -Dpython.path=%CLASSPATH% > diagtest.py > > (with identical classpath), that classpath seems to be ignored: > > Traceback (most recent call last): > > File "diagtest.py", line 8, in <module> > > from com.siemens.sibas.softsibas import SsbsController > > ImportError: No module named sibas > |