hey folks, i just began to use linux, i'm totally puzzeled, so please help me. i installed sdk, i want to run a simple java file which will output "Goodbye, world!" now, i compile the file and get a class file. but when i try to run it, i get a ClassNotFound exception: something like /usr/java/jdk1_4_1/World/class not found... i have no idea why World.class becomse World/class, this is some kind of linux bizzare stuff. thanX for ya help folks.
You didn't tell us what you were typing to run your new class, but I guess you typed something like: java World.class What you really need to type is more like: java World The Java interpreter will add the ".class" automatically.
Java is also really picky about your classpath in Linux. You need to do one of a couple of things. 1. Explicitly specify your classpath when executing your application. i.e. java -classpath "directory/of/class/file" World 2. Create an environment variable called CLASSPATH in your .bashrc (for bash shell) file. i.e. CLASSPATH=/path/to/class/files export CLASSPATH
Actually, the problem is that the current directory is NOT automatically part of the classpath. try
Did you see the little "."? It means "current directory" in both the Windows/DOS and Unix/Linux worlds (and internal to Java just about anywhere). You can alternatively export a "CLASSPATH=." in your login script if you like.
An IDE is no substitute for an Intelligent Developer.