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 running a class in a package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "running a class in a package" Watch "running a class in a package" New topic

running a class in a package

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
I have the following dir structure


all the class files are in dir d. the package name is c.d

to run class with main method I do the following

c:\exam\a\b java c.d.classWithMain

I get an error saying classNotFoundException for classWithMain

Thank you
Pavel Kubal
Ranch Hand

Joined: Mar 13, 2004
Posts: 360
Do you have installed JVM properly? 'cause your consecution is right.
Jos� Alberto Mu�iz Navarro
Ranch Hand

Joined: Oct 27, 2003
Posts: 33
c:\exam\a\b java c.d.classWithMain

Do you actually say

cd c:\exam\a\b ?

Are you sure your current working directory upon the java call is b?
I agree. Here's the link:
subject: running a class in a package
It's not a secret anymore!