C:\>glassfish3\jdk\bin\java Users\Admin\Desktop\jsp\ReadAndWriteFromFile
Exception in thread "main" java.lang.NoClassDefFoundError: Users\Admin\Desktop\jsp\ReadAndWriteFromFile (wrong name: ReadAndWriteFromFile)
You're using the
java command in the wrong way.
With the
java command, you have to specify the fully-qualified
class name of the class you are running, and not a file path. Use the classpath to specify which directories and JAR files Java must look in to find your class. Try this:
java -cp Users\Admin\Desktop\jsp ReadAndWriteFromFile
Glassfish is Oracle's reference implementation of the Java EE standard. Ofcourse you can download JDK 6 without Glassfish. But if you want to run JSPs, you do need a web container (you can't run JSPs with Java SE 6 alone).