Set your environment variables of operating system
for JAVA_HOME and PATH
JAVA_HOME should be up to jdk location and PATH should be up to bin location in jdk.
check on command prompt to see environment variables set correctly or not?
execute java - version
If you have java source file in package like below:
com.myapp.java6.features
and there is java file like ProgramWithoutMain.java
then you can compile like as:
javac -d . com/myapp/java6/features/ProgramWithoutMain.java
this give you class file when you execute this command on command prompt
then you can see the output with below command:
java com.myapp.java6.features.ProgramWithoutMain.java
for JAVA_HOME and PATH
JAVA_HOME should be up to jdk location and PATH should be up to bin location in jdk.
check on command prompt to see environment variables set correctly or not?
execute java - version
If you have java source file in package like below:
com.myapp.java6.features
and there is java file like ProgramWithoutMain.java
then you can compile like as:
javac -d . com/myapp/java6/features/ProgramWithoutMain.java
this give you class file when you execute this command on command prompt
then you can see the output with below command:
java com.myapp.java6.features.ProgramWithoutMain.java