File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes class path error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class path error" Watch "class path error" New topic

class path error

Dorj Galaa
Ranch Hand

Joined: May 29, 2001
Posts: 113
I'm use below structure set class path
java -classpath c:\ddd
but displaying error below
Usage: java [-options] class [args...]
(to execute a class)
or java -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
set a system property
enable verbose output
-version print product version and exit
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
how to set classpath from promt;


Senior software engineer
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
java -cp c:\ ddd
you must leave a space between the path and the class file.
Samith Nambiar
Ranch Hand

Joined: Mar 14, 2001
Posts: 147
setting the classpath helps the java applications find the user defines classes.

By specifying java -cp/-classpath path classfile you r overiding the default classpath which is set.

If ddd is your class file then your command would be

java -cp . ddd "." specifies all the files in the current directory.

hope that helps
(o o) harder u try luckier u get
I agree. Here's the link:
subject: class path error
jQuery in Action, 3rd edition