On Tue, 04 Oct 2011 00:14:49 -0700, masood shaik wrote: > Hi > I am trying out my hand on accessing java methods in python. here is > my piece of code.. [...] > Now i am trying to access the calculateTip() and its showing import > error. > It works fine when i am running it with jython but why its not happening > in python.
Jython *is* Python. It is a Python implementation built on the Java virtual machine. Integrating Java with Python is a major reason for using Jython. http://www.jython.org/ You can't just import a Java library into the C implementation of Python, any more than you can just import a Python library into Java. You need an interface between them. Jython includes one such interface. The C reference implementation of Python does not. To integrate Java libraries with CPython is harder, but not impossible. I have never tried any of these, but you could try JPype, Py4J, or JCC: http://jpype.sourceforge.net/ http://py4j.sourceforge.net/index.html http://pypi.python.org/pypi/JCC/2.1 -- Steven -- http://mail.python.org/mailman/listinfo/python-list