I tried running this on unix with javac & java command but it does not work
public class CommandLine {
public static void main( String[] args ) {
for( int i = 0; i < args.length; i++ ) {
System.out.println( args[ i ] );
}
}
}
I tried running this on unix with javac & java command but it does not work
public class CommandLine {
public static void main( String[] args ) {
for( int i = 0; i < args.length; i++ ) {
System.out.println( args[ i ] );
}
}
}
When calling javac, list the .java file extension:
javac CommandLine.java
When calling java, do not list a file extension:
java CommandLine
The compiled class resides in the file CommandLine.class. So it would make sense for the command to run the program to be java CommandLine.class. However, java demands that the .class extension be dropped.