http://maven.apache.org/guides/mini/guide-creating-archetypes.html
> vi Test1.java
public class Test {
public static void main(String args[]){
System.out.println("Hello Java");
}
}
>javac Test1.java
Test1.java:2: error: class Test is public, should be declared in a file named Test.java
public class Test { ^1 error
Solution:
1. To correct the defined class name "Test" to "Test1" in order to match the file's name
2. To remove the keyword "public" from the declared class.
> vi Test1.java
class Test {
public static void main(String args[]){
System.out.println("Hello Java");
}
}
compile and run
> ll
-rw-r--r-- 1 zhishan users 96 Aug 7 13:14 Test1.java
> javac Test1.java
> ll
-rw-r--r-- 1 zhishan users 96 Aug 7 13:14 Test1.java
-rw-r--r-- 1 zhishan users 413 Aug 7 13:15 Test.class
>java Test
Hello Java