This is a bit of a hack, I'm sure there's better our there, but if everything else fails, remember that JAR files are just ZIPs, and that each class will have a . Class file in the jar.
Up vote 0 down vote favorite share g+ share fb share tw.
I find it tedious to import a java class in jython because of the long package names. E.g. Com.example.x.y.z.SomeClass.
It's a lot of typing. I want to import by using only the simple name of the class (SomeClass in my example). Is there a way of achieving it?
Current solution in my head is to enumerate all the classes in the classpath and prepare a map of simple class name to the complete package name like - SomeClass -> com.example.x.y.z. SomeClass SomeOtherClass -> com.example.p.q.r. SomeOtherClass etc. Then call a function something like below- def intelligent_import(simple_class_name): #No error checking, simplified for clarity package_name = dictsimle_class_name simple_class_name = __import__(package_name) for each of the classes.
The only problem is that I don't know a method to enumearte all classes in a directory. Is there's a better way to do this? If not a method to enumerate all java classes in a directory will do.
Jython link|improve this question edited Jan 11 at 18:24 asked Dec 19 '11 at 14:27Raminder826516 91% accept rate.
This is a bit of a hack, I'm sure there's better our there, but if everything else fails, remember that JAR files are just ZIPs, and that each class will have a . Class file in the jar. However, rather than hacking the import mechanism like this, I'd rather just use an IDE with proper autocompletion (i.e.
Eclipse/PyDev, it's the only one that can do it reliably in my experience), and rock the ctrl-space.
1 to using Eclipse/PyDev here (I'm biased as I'm its author, but I do develop quite a bit of Python code using PyDev itself and the auto-import is invaluable IMHO). – Fabio Zadrozny Jan 4 at 17:40.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.