Neetz
Neetz

Reputation: 364

Couldnt find the main class

Well, i complile my program using this command in Ubuntu

javac -classpath .:/home/ss/lucene-4.0.0/core/lucene-core-4.0.0.jar:/home/ss/lucene-4.0.0/queryparser/lucene-queryparser-4.0.0.jar:/home/ss/lucene-4.0.0/analysis/common/lucene-analyzers-common-4.0.0.jar:/home/ss/lo.jar:/home/neetish/mysql-connector-java-5.1.25-bin.jar kel.java

It compiles.

And I run using

  java -classpath .:/home/ss/lucene-4.0.0/core/lucene-core-4.0.0.jar:/home/ss/lucene-4.0.0/queryparser/lucene-queryparser-4.0.0.jar:/home/ss/lucene-4.0.0/analysis/common/lucene-analyzers-common-4.0.0.jar:/home/ss/lo.jar:/home/ss/mysql-connector-java-5.1.25-bin.jar kel.java

and i Get

Could not find or load main class kel.java

can anyone help me plz

Upvotes: 5

Views: 287

Answers (4)

Ruchira Gayan Ranaweera
Ruchira Gayan Ranaweera

Reputation: 35547

If there is a main() method in kel.java and if it is successfully compile then

you can run it using following command.

java -classpath kel

in your case you are trying to run kel.java. That is wrong.

Upvotes: 0

user225716
user225716

Reputation: 1

After compilation, just give class name, instead kel.java. Just mention kel.

Upvotes: 0

Pyae Thu Aung
Pyae Thu Aung

Reputation: 313

After compilation, you can run by java kel. Simply remove the .class from you compiled file.

Upvotes: 0

Uwe Plonus
Uwe Plonus

Reputation: 9954

Even though your source file's name kel.java, your class' name is just kel

You have to start your program with

java -cp ... kel

You should not add any suffix to the class name.

Upvotes: 4

Related Questions