Can’t import my own modules in Python

In your particular case it looks like you’re trying to import SomeObject from the myapp.py and TestCase.py scripts. From myapp.py, do since it is in the same folder. For TestCase.py, do However, this will work only if you are importing TestCase from the package. If you want to directly run python TestCase.py, you would have to mess with … Read more

package does not exist error!

This works: com/example/model/BearExtra.java com/example/web/Bear.java Now, to compile and run these classes, go to the directory where you can “see” the com folder and do: *nix/MacOS Windows and the following is being printed to the console:

What’s the difference between import java.util.*; and import java.util.stream;?

I doubt that the second attempt (import java.util.stream;) works. As JonSkeet pointed out in their comment, it should result in a compilation error: error: cannot find symbol. Maybe you wanted to import java.util.stream.*;? To the actual question: If we import with a wildcard, that is the asterisk (*) character, only the direct classes in this package will be imported, not the … Read more

Why java unknown: import org.apache.commons.codec.binary.Base64;?

You need to add the Apache Commons Codec library to your project. You either need to download the *.jar file and add it to the project folder and project configuration or you let your build processor automatically download it. See https://mvnrepository.com/artifact/commons-codec/commons-codec/1.9 Latest is version 1.15 This website provides a download link for the *.jar file as well … Read more

Python circular importing?

I think the answer by jpmc26, while by no means wrong, comes down too heavily on circular imports. They can work just fine, if you set them up correctly. The easiest way to do so is to use import my_module syntax, rather than from my_module import some_object. The former will almost always work, even if my_module included imports us back. The latter … Read more

Java Package Does Not Exist Error

Are they in the right subdirectories? If you put /usr/share/stuff on the class path, files defined with package org.name should be in /usr/share/stuff/org/name. EDIT: If you don’t already know this, you should probably read this doc about understanding classpath. EDIT 2: Sorry, I hadn’t realised you were talking of Java source files in /usr/share/stuff. Not only they need to be in the … Read more