-1

I am trying to run a java code in command prompt. I have the java file in a folder abc in D drive. I have 2 jars also in the same folder. Compilation is done. Class file is created within the folder abc. When trying to execute it using java command, I am getting error "could not find or load main class". Could someone please help me? I am using the below command in cmd: java -cp D:/Java_mail/javax.mail.jar;D:/Java_mail/activation.jar Emailfetch

Devjith
  • 19
  • 4

1 Answers1

0

To be able to run a JAR file, you must have your jar as runnable. It means you must have a class in it that has

public static void main(String[] args)

https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

Otherwise you will not be able to run it.

Simion
  • 353
  • 1
  • 9