how to run jython coverage with an explicit java.exe?

"Niemann, Hartmut" <[email protected]> Tue, 15 Feb 2022 10:33:04 +0000
Newsgroups gmane.comp.lang.jython.user
Message-ID <PR3PR10MB4240BAF77B0B6C59AD775822FC349@PR3PR10MB4240.EURPRD10.PROD.OUTLOOK.COM>
--===============4479594729958901017==
Content-Language: de-DE
Content-Type: multipart/alternative;
	boundary="_000_PR3PR10MB4240BAF77B0B6C59AD775822FC349PR3PR10MB4240EURP_"

--_000_PR3PR10MB4240BAF77B0B6C59AD775822FC349PR3PR10MB4240EURP_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi!

I need to specify which java is used for a coverage run.

I am using Jython 2.7.0 and coverage 3.4.3

I used to use "coverage.exe" but how could I tell it which java to start?

I succeded starting "jython.exe  coverage-script.py" , but same problem: wh=
ich java VM is used?

I can run Jython with an explicit JAVA executable and some simple example
%JAVA64% -jar "somepath\jython.jar" %JYTHON_DIR%\bin\hello.py

But when I combine these to

%JAVA64% -jar "C:\SIBAS32\JAVA_LIBS\jython\jython.jar" %JYTHON_DIR%\bin\cov=
erage-script.py

I get
Traceback (most recent call last):
  File "C:\DEVTOOLS\Jython\2.7.0\bin\coverage-script.py", line 5, in <modul=
e>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

So I would need to convince coverage.exe or jython.exe to use the Java.exe =
I want, or teach java.exe -jar ... coverage-script.py where to look for the=
 pkg_resources directory.

On
https://www.jython.org/jython-old-sites/archive/21/docs/interpreter.html
I found the sentence
"jython is a short script that invokes your local JVM, [..]"
which unfortunately does not tell me how the JVM is selected from the (four=
?) JVMs I have installed.

What would you recommend?

Regards
Hartmut


--_000_PR3PR10MB4240BAF77B0B6C59AD775822FC349PR3PR10MB4240EURP_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
tt
	{mso-style-priority:99;
	font-family:"Courier New";}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"DE" link=3D"#0563C1" vlink=3D"#954F72" style=3D"word-wrap:bre=
ak-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi!<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I need to specify which java is=
 used for a coverage run.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I am using Jython 2.7.0 and cov=
erage 3.4.3<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I used to use &#8220;coverage.e=
xe&#8221; but how could I tell it which java to start?<o:p></o:p></span></p=
>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I succeded starting &#8220;jyth=
on.exe &nbsp;coverage-script.py&#8221; , but same problem: which java VM is=
 used?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I can run Jython with an explic=
it JAVA executable and some simple example
<o:p></o:p></span></p>
<p class=3D"MsoNormal">%JAVA64% -jar &quot;somepath\jython.jar&quot; %JYTHO=
N_DIR%\bin\hello.py<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">But when I combine these to <o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">%JAVA64% -jar &quot;C:\SIBAS32\=
JAVA_LIBS\jython\jython.jar&quot; %JYTHON_DIR%\bin\coverage-script.py<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I get <o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Traceback (most recent call las=
t):<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; File &quot;C:\DEVTOOLS\J=
ython\2.7.0\bin\coverage-script.py&quot;, line 5, in &lt;module&gt;<o:p></o=
:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp; from pkg_res=
ources import load_entry_point<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">ImportError: No module named pk=
g_resources<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">So I would need to convince cov=
erage.exe or jython.exe to use the Java.exe I want, or teach java.exe -jar =
&#8230; coverage-script.py where to look for the pkg_resources directory.<o=
:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">On<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><a href=3D"https://www.jython.o=
rg/jython-old-sites/archive/21/docs/interpreter.html">https://www.jython.or=
g/jython-old-sites/archive/21/docs/interpreter.html</a><o:p></o:p></span></=
p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I found the sentence<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&#8220;</span><tt><span lang=3D=
"EN-US" style=3D"font-size:10.0pt">jython</span></tt><span lang=3D"EN-US"> =
is a short script that invokes your local JVM, [..]&#8221;<o:p></o:p></span=
></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">which unfortunately does not te=
ll me how the JVM is selected from the (four?) JVMs I have installed.<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">What would you recommend?<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Regards<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Hartmut<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</body>
</html>

--_000_PR3PR10MB4240BAF77B0B6C59AD775822FC349PR3PR10MB4240EURP_--


--===============4479594729958901017==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============4479594729958901017==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users

--===============4479594729958901017==--