raises the error "Unresolved import", flagged in the left hand margin
However, if the code is run it actually works - which is very confusing as the IDE is telling you there are errors and yet the code will run. This does not instill me with confidence with respect to future error messages.
Adding #@UnresolvedImport at the end of the import statement:
import java.util.ArrayList as ArrayList #@UnresolvedImport
stops the left-hand-margin error message.
Furthermore, I notice that there is no field/method popup listing in the editor when adding defining an object of a Java class.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, probably the real case is that the Java rt.jar is not added to your Jython interpreter configuration… this should be auto-detected by PyDev, but maybe there was a problem there in that step - can you see if 'rt.jar' is in the System libs?
I'm having the same problem. I can run my jython scripts fine, but the eclipse code analyzer can't seem to resolve any of the Java imports. I looks like my PYTHONPATH has all the Java .jar files . I could just suppress the errors, although I would like to be able to view Java docs like I can when I using eclipse for Java.
Anyone have any ideas of what I can check next.
Thanks,
Aaron
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I'm working my way thro the Jython book at:
http://www.jython.org/jythonbook/en/1.0/DataTypes.html#lists-dictionaries-sets-and-tuples
and in Listing 2-27 it states:
# Import and use a Java ArrayList
>>> import java.util.ArrayList as ArrayList
This works in the command-line window but does not work in Eclipse and complains with "Unresolved import".
I'm confused by this as I'm using the Jython interpreter and assumed it has access to the Java api, as illustrated by how the command-line works.
Thanks
Graham
It appears this is a peculiar feature/bug of PyDev and discussed elsewhere:
http://stackoverflow.com/questions/1702043/how-can-i-make-the-pydev-editor-selectively-ignore-errors
The following import:
import java.util.ArrayList as ArrayList
raises the error "Unresolved import", flagged in the left hand margin
However, if the code is run it actually works - which is very confusing as the IDE is telling you there are errors and yet the code will run. This does not instill me with confidence with respect to future error messages.
Adding #@UnresolvedImport at the end of the import statement:
import java.util.ArrayList as ArrayList #@UnresolvedImport
stops the left-hand-margin error message.
Furthermore, I notice that there is no field/method popup listing in the editor when adding defining an object of a Java class.
Actually, probably the real case is that the Java rt.jar is not added to your Jython interpreter configuration… this should be auto-detected by PyDev, but maybe there was a problem there in that step - can you see if 'rt.jar' is in the System libs?
See: http://imageshack.us/photo/my-images/30/jythoninterpreterconfig.png for an example on how it should look like…
Cheers,
Fabio
Hi
Thanks for your reply.
I have all of the jars listed under System libs shown in your screenshot except:
QTJava, sunmscapi and sunpkcs11
So, yes the rt.jar is included.
PS. I am using Jython2.5.2
Graham
I'm having the same problem. I can run my jython scripts fine, but the eclipse code analyzer can't seem to resolve any of the Java imports. I looks like my PYTHONPATH has all the Java .jar files . I could just suppress the errors, although I would like to be able to view Java docs like I can when I using eclipse for Java.
Anyone have any ideas of what I can check next.
Thanks,
Aaron