2

I am new to Jython. I downloaded a jar file from here http://www.jython.org/downloads.html

Download Jython 2.7beta1 - jython.jar Installer : Standalone version without the bundled python files.

When I run it:

$ java -jar jython-2.7-b1.jar 
Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_33
>>> print "hello"
... 

I didn't get echoed string "hello", instead I got "...".

I guess the point here is what are the "bundled python files" those are missed from this jar.

JackWM
  • 10,085
  • 22
  • 65
  • 92
  • You're supposed to run `print 'text2print'`, not `print('text2print')`. Jython 2.7 is based on Python 2.7, not Python 3. – kirbyfan64sos Jul 19 '13 at 16:06
  • @kirbyfan64sos Thanks for pointing it out. I just tried the one without braces, but same issue happened. – JackWM Jul 19 '13 at 16:54
  • What if you press enter at the ellipsis? Sounds like Jython is expected more. – kirbyfan64sos Jul 19 '13 at 17:38
  • @kirbyfan64sos I would keep getting more ellipsis. – JackWM Jul 19 '13 at 18:02
  • Similar to this question: http://stackoverflow.com/q/13794278/407651 – mzjn Jul 19 '13 at 18:16
  • Looks like a bug. I guess the interpreter isn't picking up the string end. What if you put the print statement in a file? And, what if you put a quote at one of the ellipsis? – kirbyfan64sos Jul 19 '13 at 19:52
  • @kirbyfan64sos It has the same problem when I put print in a file. If I just type a `"` after the `...`, I got error `LookupError: no codec search functions registered: can't find encoding 'macroman'` – JackWM Jul 20 '13 at 02:52
  • I'd help more, but I don't know Java well, so I would probably send you on a wild goose chase. – kirbyfan64sos Jul 20 '13 at 23:26

1 Answers1

4

The "bundled python files" are Python standard library modules (such as os.py) found in the Lib folder of a Jython installation.

When running Jython in standalone mode, everything -- including the bundled Python files -- is packaged in a single jar file. The current release for Jython 2.7 is jython-standalone-2.7-b1.jar. When using this jar file, I do not see the strange behaviour shown in the question. The simple print statement works:

$ java -jar jython-standalone-2.7-b1.jar
Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_03
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello"
hello
>>>

The jython-2.7-b1.jar file is a variant of standalone Jython that does not include the bundled Python files. I don't know why anyone would want to use it. I haven't been able to find any documentation that explains why it is provided as a separate download at http://www.jython.org/downloads.html.

mzjn
  • 48,958
  • 13
  • 128
  • 248