Re: Setting UTF8 for Source

Jeff Allen <[email protected]> Tue, 13 Aug 2019 20:21:46 +0100
Newsgroups gmane.comp.lang.jython.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0259254614569082213==
Content-Type: multipart/alternative;
 boundary="------------C4BFA4F7252856240ED67EAD"
Content-Language: en-GB

This is a multi-part message in MIME format.
--------------C4BFA4F7252856240ED67EAD
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

It can't find the class, so it is probably not a problem with UTF-8. I 
don't understand why JNI is mentioned, but the inner exception suggests 
the jython JAR is not on the class path, either at compile time or run-time.

Jeff Allen

On 13/08/2019 12:34, Евгений Король wrote:
> Hello. I try to use Russian in Jython under Java. I found example like this:
> PythonInterpreter interpreter = new PythonInterpreter() {
>              {
>                  cflags = new CompilerFlags(CompilerFlags.PyCF_SOURCE_IS_UTF8);
>              }
>          };
>
> And when i use it in Java it works and Jython is output in Unicode.
> But when i compile it with Java Compiler API i have this error:
> Error: A JNI error has occurred, please check your installation and try again
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/python/util/PythonInterpreter
>          at java.lang.Class.getDeclaredMethods0(Native Method)
>          at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
>          at java.lang.Class.privateGetMethodRecursive(Unknown Source)
>          at java.lang.Class.getMethod0(Unknown Source)
>          at java.lang.Class.getMethod(Unknown Source)
>          at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
>          at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
> Caused by: java.lang.ClassNotFoundException: org.python.util.PythonInterpreter
>          at java.net.URLClassLoader.findClass(Unknown Source)
>          at java.lang.ClassLoader.loadClass(Unknown Source)
>          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>          at java.lang.ClassLoader.loadClass(Unknown Source)
>          ... 7 more
>
> What i can do?
>
>
> _______________________________________________
> Jython-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-users
>

--------------C4BFA4F7252856240ED67EAD
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>It can't find the class, so it is probably not a problem with
      UTF-8. I don't understand why JNI is mentioned, but the inner
      exception suggests the jython JAR is not on the class path, either
      at compile time or run-time.<br>
    </p>
    <pre class="moz-signature" cols="72">Jeff Allen
</pre>
    <div class="moz-cite-prefix">On 13/08/2019 12:34, Евгений Король
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+Mbm5wSzDGg4pZr059VfSs6eOzc9ui6YH-0k2zzyByb6f02_g@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">Hello. I try to use Russian in Jython under Java. I found example like this:
PythonInterpreter interpreter = new PythonInterpreter() {
            {
                cflags = new CompilerFlags(CompilerFlags.PyCF_SOURCE_IS_UTF8);
            }
        };

And when i use it in Java it works and Jython is output in Unicode.
But when i compile it with Java Compiler API i have this error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError:
org/python/util/PythonInterpreter
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.python.util.PythonInterpreter
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more

What i can do?


_______________________________________________
Jython-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/jython-users">https://lists.sourceforge.net/lists/listinfo/jython-users</a>

</pre>
    </blockquote>
  </body>
</html>

--------------C4BFA4F7252856240ED67EAD--


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


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

--===============0259254614569082213==--