Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't find class

 
Kelly Rakes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help,
Excuse the newbee question
I have compiled code and can see .class files in the directory I am working in, but when I type the command line java classname it I get the message "Can't find class classname"
Thanks in advance
Kelly Rakes
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the exact command that you are trying to use and what directory are you working in? Is it the same directory where the class file is?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and...
Welcome to JavaRanch!
 
Kelly Rakes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The directory is pretty long
"D:\jdev9i_rc2\jdev\mywork\Kellys\Registrar\src\Registrar"
When I navigate to that directory in the command shell and type javac classname.java it compiles and places a file classname.class in the directory. I have placed the directroy listed above in the class path as directed for W2K setup, I have also changed the runtime classpath by typing java -classpath D:\jdev9i_rc2\jdev\mywork\Kellys\Registrar\src\Registrar.
Any help would be apriciated
Thanks in advance
 
Kelly Rakes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also the exact command is "java classname"
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.) Try to put a .(dot) in your CLASSPATH.
2.) If the java source has a package in the top, you need to compile like this: javac com/sun/java/Test.java and run the code like this: java com.sun.java.Test
/Rene
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic