I have two classes Pair.java
and Users.java
where Users.java
has the main program. Both these java files are under the package userdetails
.
In unix, I compiled it using the command
javac -d . -classpath avro-1.7.5.jar:lib/*:jackson-core-asl-1.9.13.jar:lib/* Pair.java Users.java
the class are under the folder userdetails. I tried to run using the command
java -classpath avro-1.7.5.jar:lib/*:jackson-core-asl-1.9.13.jar:lib/* userdetails.Users
I'm getting error
Could not find main class userdetails.Users
Kindly help me.
source code :-
import java.io.File;
import java.io.IOException;
import org.apache.avro.file.DataFileReader;
import org.apache.avro.file.DataFileWriter;
import org.apache.avro.io.DatumReader;
import org.apache.avro.io.DatumWriter;
import org.apache.avro.specific.SpecificDatumReader;
import org.apache.avro.specific.SpecificDatumWriter;
import org.apache.avro.util.Utf8;
public class Users {
public void createUser() {
userdetails.Pair datum = new userdetails.Pair(new Utf8("L"), new Utf8("R"));
DatumWriter writer = new SpecificDatumWriter();
DataFileWriter fileWriter = new DataFileWriter(writer);
try {
fileWriter.create(datum.getSchema(), new File("users.avro"));
fileWriter.append(datum);
System.out.println(datum);
fileWriter.close();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("ERROR");
e.printStackTrace();
} }
public static void main(String[] args) {
Users user = new Users();
user.createUser();
}
}