Android – Command not found

On MacOS/Linux, define the path to wherever you installed your SDK as ANDROID_HOME: MacOS If you installed Android Studio, the value will need to be Linux Then add the paths to the platform-tools and tools sub-directories (Same on MacOS/Linux). You should now be able to run android from the shell. If none of the suggested … Read more

How to really read text file from classpath in Java

With the directory on the classpath, from a class loaded by the same classloader, you should be able to use either of: If those aren’t working, that suggests something else is wrong. So for example, take this code: And this directory structure: And then (using the Unix path separator as I’m on a Linux box): … Read more

Eclipse “Error: Could not find or load main class”

In your classpath you’re using an absolute path but you’ve moved the project onto a new machine with quite possibly a different file structure. In your classpath you should therefore (and probably in general if you’re gonna bundle JARS with your project), use relative pathing: In your .classpath change to

Unbound classpath container in Eclipse

Given the FAQ, sharing a project file seems have to have advantages and is even recommended practice for Java projects (personally, I would not do that). Maybe some of the following work for you: Edit the project’s properties (right-click project, Properties, Java Build Path, Libraries, Remove and Add Library. Import the project’s files without the “project … Read more

Problems with setting the classpath in ant

I think the problem is with your classpath path declaration. The build directory should be a <pathelement> Also, I would only include 3-rd party jars in your classpath refid. So the whole block looks like. Also, as DroidIn.net has pointed out, you should create a package for you program.

Differences between “java -cp” and “java -jar”?

I prefer the first version to start a java application just because it has less pitfalls (“welcome to classpath hell”). The second one requires an executable jar file and the classpath for that application has to be defined inside the jar’s manifest (all other classpath declaration will be silently ignored…). So with the second version … Read more

What is a classpath and how do I set it?

When programming in Java, you make other classes available to the class you are writing by putting something like this at the top of your source file: Or sometimes you ‘bulk import’ stuff by saying: So later in your program when you say: The Java Virtual Machine will know where to find your compiled class. … Read more