ewom2468
ewom2468

Reputation: 841

Main Class Not Found

I am to connect to a MySQL database from a Java application to store images taken from a scanned form. When I run the program I get a Could not find or load main class error.

I have tried setting the classpath but still get the same error: Could not find or load main class. By the way, another java file I created in the directory compiles. When I try to set the classpath I also get the same error. Here is the (EDITED)code:

java -cp "C:\Documents and Settings\xxx\Desktop\ttt_manual_yyy\mysql\mysql-connector-java-5.1.6-bin" ImageUploader C:\Documents and Settings\yyy\Desktop\IMAGES localhost uuu nnn

Where localhost is database address,uuu is username,nnn is password

Upvotes: 0

Views: 328

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499770

You're not even specifying a class, and you need to put your classpath in quotes as it's got spaces. So it should be something like:

java -classpath "C:\Documents and Settings\...\ImageUpload" foo.ImageUploader

where foo.ImageUploader is the fully-qualified name of the class containing the main method.

Upvotes: 7

Related Questions