0

my project structure

ProjectName
|--lib
|--Src
    |__Com
        |_Sample
            |_project
               |_.java files .....

I am running a standalone java program in cmd line

Firts i compiled it this below, got no error

d:\ProjectName\src\com\Sample\project> javac -cp d:\projectName\lib\log4j-1.2.17.jar;d:\projectName\lib\mysql-connector.jar; 
JdbcConnection.java Constants.java PropertiesUtil.java Metrics.java

So i tried executing program like below

d:\ProjectName\src\com\Sample\project> java -cp d:\projectName\lib\log4j-1.2.17.jar;d:\projectName\lib\mysql-connector.jar; 
JdbcConnection.java Constants.java PropertiesUtil.java Metrics.java

Gives me error saying

Error:Class not find or load main class JdbcConnection.java

What should i do for this? Any help is appreciated

dafodil
  • 531
  • 15
  • 30
  • `java JdbcConnection` not `java JdbcConnection.java`. – passion Oct 08 '16 at 08:04
  • Besides potential spelling problems: your java command needs to have **all** classes in the classpath. For your second call you do **not** have anything that points to the directory where you have your freshly compiled classes! – GhostCat Oct 08 '16 at 08:06
  • http://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean – Pshemo Oct 08 '16 at 09:00
  • @GhostCat Can you explain with some example? – dafodil Oct 08 '16 at 10:27
  • Sorry, but please learn to use the information that was **already** given to you. You have by now two other questions which explain in **great** detail how these things work. Do not expect us to explain it **again** to you, just because you prefer to be taught, instead of doing the learning yourself! – GhostCat Oct 08 '16 at 11:15

0 Answers0