Re: need help | Issue in compiling Main.java | Jython

Hasan Diwan <[email protected]> Sat, 27 Jul 2019 12:57:19 -0700
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAP+bYWDp31VrNfMmidFiNdjkNk--E2Bkg-3eQoiRDn8Fo4gWKg@mail.gmail.com>
--===============4042481638670274614==
Content-Type: multipart/alternative; boundary="000000000000b59802058eaf0f49"

--000000000000b59802058eaf0f49
Content-Type: text/plain; charset="UTF-8"

Santhosh,

On Sat, 27 Jul 2019 at 12:36, Santhosh Kumar J <[email protected]>
wrote:

> Is there any solution to the problem i'm facing?
>

You can embed the .py in your jar file and load it like this:

public static void exec() {
     PythonInterpreter interp = new PythonInterpreter();
     StringWriter outputFromJython = new StringWriter();
     interp.setOut(outputFromJython);
     interp.execfile(inputStreamRepreesntingPyFile); // outputFromJython
contains output of execing script
}


-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
<http://bit.ly/hd1AppointmentRequest>*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
<http://bit.ly/hd1AppointmentRequest>*.

<https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent
from my mobile device
Envoye de mon portable

--000000000000b59802058eaf0f49
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Santhosh,</div><br><div class=3D"gmail_qu=
ote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, 27 Jul 2019 at 12:36, Sa=
nthosh Kumar J &lt;<a href=3D"mailto:[email protected]">santhoshj55@o=
utlook.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">



<div dir=3D"auto">
<div>Is there any solution to the problem i&#39;m facing?<br></div></div></=
blockquote><div><br></div><div>You can embed the .py in your jar file and l=
oad it like this:</div><div><br></div><div>public static void exec() {</div=
><div>=C2=A0 =C2=A0 =C2=A0<span style=3D"color:rgb(0,0,0)">PythonInterprete=
r interp =3D</span><span style=3D"color:rgb(0,0,0)">=C2=A0new PythonInterpr=
eter();</span></div><div><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0 =C2=
=A0StringWriter outputFromJython =3D new StringWriter();</span></div><div><=
span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0 =C2=A0interp.setOut(outputFro=
mJython);</span></div><div><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0 =
=C2=A0interp.execfile(inputStreamRepreesntingPyFile); // outputFromJython c=
ontains output of execing script</span></div><div><span style=3D"color:rgb(=
0,0,0)">}</span></div><div>=C2=A0 =C2=A0 =C2=A0</div><br class=3D"gmail-App=
le-interchange-newline"></div>-- <br><div dir=3D"ltr" class=3D"gmail_signat=
ure"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div=
 dir=3D"ltr"><div><div dir=3D"ltr"><div>OpenPGP:=C2=A0<a href=3D"https://sk=
s-keyservers.net/pks/lookup?op=3Dget&amp;search=3D0xFEBAD7FFD041BBA1" targe=
t=3D"_blank">https://sks-keyservers.net/pks/lookup?op=3Dget&amp;search=3D0x=
FEBAD7FFD041BBA1</a></div><div>If you wish to request my time, please do so=
 using=C2=A0<font color=3D"#0000ee"><u><a href=3D"http://bit.ly/hd1Appointm=
entRequest" target=3D"_blank">bit.ly/hd1AppointmentRequest</a></u></font><s=
pan style=3D"font-size:9.6px">.</span></div><div>Si vous voudrais faire con=
nnaisance, allez a <font color=3D"#0000ee"><u><a href=3D"http://bit.ly/hd1A=
ppointmentRequest" target=3D"_blank">bit.ly/hd1AppointmentRequest</a></u></=
font>.</div><div><font color=3D"#222222"><a href=3D"https://sks-keyservers.=
net/pks/lookup?op=3Dget&amp;search=3D0xFEBAD7FFD041BBA1" target=3D"_blank">=
<font color=3D"#222222"><br></font></a></font>Sent from my mobile device</d=
iv><div>Envoye de mon portable</div></div></div></div></div></div></div></d=
iv></div></div></div><div></div><span><img alt=3D"" width=3D"1" height=3D"1=
" src=3D"https://gml.email/v3.2/t/image/VUlEfDA5NTdmNzZlLTE3Y2EtNDljYy1iNzU=
0LTE2YzYxMGQ1ZTgxMXxzb21lb25lQHVua25vd24uY29t.gif" id=3D"gml-hasan.diwan@gm=
ail.com1564257438"></span></div>

--000000000000b59802058eaf0f49--


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


--===============4042481638670274614==
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

--===============4042481638670274614==--