Hi. First, I'm not sure if this is the correct group, but becuase I
couldn't find a jython newsgroup, I'll post here.
I'm new to jython and am just trying to get it to work. Interpreted
jython works just fine, but I still can't get my compiled jython to
work.
When I do this:
jythonc fac.py (where fac.py is a jython program), it creates a
jpywork directory with three files fac.java, fac.class, and fac
$_PyInner.class
But if I cd to that directory and do this:
java -classpath $JYTHON_HOME/jython.jar fac
I get this error:
Exception in thread "main" java.lang.NoCla ssDefFoundError : fac
My fac.py looks like this:
def fac(x):
if x <= 1: return 1
return long(x) * fac(x-1)
if __name__ == "__main__":
print 1 + 2
print "Hello" + "Goodbye"
print "fac(3): "
print fac(3)
print "fac(100): "
print fac(100) 1 1488
kramer31 wrote:
Hi. First, I'm not sure if this is the correct group, but becuase I
couldn't find a jython newsgroup, I'll post here.
I'm new to jython and am just trying to get it to work. Interpreted
jython works just fine, but I still can't get my compiled jython to
work.
When I do this:
jythonc fac.py (where fac.py is a jython program), it creates a
jpywork directory with three files fac.java, fac.class, and fac
$_PyInner.class
But if I cd to that directory and do this:
java -classpath $JYTHON_HOME/jython.jar fac
I get this error:
Exception in thread "main" java.lang.NoCla ssDefFoundError : fac
My fac.py looks like this:
def fac(x):
if x <= 1: return 1
return long(x) * fac(x-1)
if __name__ == "__main__":
print 1 + 2
print "Hello" + "Goodbye"
print "fac(3): "
print fac(3)
print "fac(100): "
print fac(100)
Build your jar with the following:
$ jythonc -j fac.jar -a fac.py
Then run it with the following:
$ java -jar fac.jar
3
HelloGoodbye
fac(3):
6
fac(100):
933262154439441 526816992388562 667004 [...]
Some more hints and suggestions:
1. If you want to generate a java class usable from java, then your module
must obey a few rules: (1) It must be contain one class whose name is the
same as the module name. (2) That class must inherit from some Java class.
2. If you have not already found it, see this page for more information: http://www.jython.org/docs/jythonc.html
3. jythonc is deprecated, I believe. It is unclear what will happen to it
in the next version of jython. So, maybe you do not want to get too
dependent on it.
Hope this helps.
Dave
--
Dave Kuhlman http://www.rexx.com/~dkuhlman This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Benjamin |
last post by:
Hey good people,
I've been doing a lot of simultaneous Jython and CPython programming lately,
and just wanted to say, with no intended ill will toward any of the
individuals who have been generous enough to make the two languages
possible, that, well, they're kinda different.
I guess it was inevitable, but with Jython stuck at Python 2.1,...
|
by: monkey |
last post by:
Hi all, I am new to programming, already have a glace on introduction of
c++, java and finally decided on python. But I found that the .py file is
just like the source file, how can I make a program without revealing its
source? (may be my question is a little bit stupid)
|
by: Nadeem Mohsin |
last post by:
Me and a couple of friends have been thinking of doing something
involving Python for our final year undergrad project. We're
considering the first idea mentioned on this page:
http://wiki.python.org/moin/JythonProjects.
Unfortunately, their statement is a little terse, so I was hoping
someone could give us a better idea of what they...
|
by: py |
last post by:
I want to serialize an object in jython and then be able to read it in
using python, and vice versa.
Any suggestions on how to do this? pickle doesnt work, nor does using
ObjectOutputStream (from jython).
I prefer to do it file based ...something like
pickle.dump(someObj, open("output.txt", "w"))
|
by: didier.prophete |
last post by:
Ok, so I know this is probably a common jython error, but somehow I
can't seem to find an answer to this trivial problem.
Ok, I have the following (simple) directory structure:
$TOP/
__init__.py
py_dir/
__init__.py
util.py
| |
by: Mark Fink |
last post by:
Hi there,
I have a source file FailFixture.py in the folder
D:\AUT_TEST\workspace\JyFIT\testutil. Now I want to import the file
with "import testutil.FailFixture". Unfortunately I could not figure
out how to set this up. I am convinced that
"D:\AUT_TEST\workspace\JyFIT" should be included in the pythonpath but
it does not work. Nor does it...
|
by: Gregor Stich |
last post by:
Dear all,
I hope my question is here in the right place...
What I want to achieve is a communication between Java and Python. We
have a pretty strong framework of existing python scripts and modules.
Now I want to use jython in order to faciliate the communication
between another Java framework.
But I`m currently stuck with jython:...
|
by: Ant |
last post by:
Hi All,
I'm looking to provide online python documentation for several jython
modules: does anyone know if there are tools to create documentation
from docstrings that work in Jython? Jython doesn't provide the pydoc
module.
I've looked into HappyDoc, which is supposed to work on jython as well
as python (since it parses the code tree...
|
by: =?ISO-8859-1?Q?S=E9bastien_Boisg=E9rault?= |
last post by:
Frank Wierzbicki and Ted Leung have been hired by Sun. Frank is a
key Jython developer and is specifically hired to work full time on
Jython, a version of the Python interpreter that runs on top of the
JVM and provides full access to Java libraries. After a period where
the development had slowed, Jython was recently getting seriously
back on...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |