I am in a Java class in my college right now, and we have to be able to compile java programs via the terminal. I would like to keep using my Ubuntu installation for it though. whenever I try to compile something on Ubuntu, nobody can read the program. Says something about it not being able to read the program. I have installed the "openjdk-7-jdk" program, which might be the issue. Any help is appreciated, thanks! On a side note, I would like to mention that I need to compile my programs on OS X Lion or Windows 7 in order to run them correctly...
Chances are your colleagues are using Java 6. In that case, you have to install
openjdk-6-jdk
.Recall that single
.java
source files are compiled using:.class
files are executed like:This expects a
Hello.class
file in the current directory. If you're working in a different directory, you need to set the-classpath
(or-cp
) option: