• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't compile : Class not found  RSS feed

 
Clair McGray
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I'm having problem compiling my code

I have a jar file with some interfaces located at c:\temp\jarfile.jar

I'm implementing these interfaces using two classes Hello & Bye

both Hello & Bye are located in folder c:\temp\status and both start with "package status;"


and thats how they begin


when i compile Hello, I get an exception that Bye cannot be found at this line "cannot find symbol: Class Bye"



thats the command i'm using to compile the code


Thank you
[ September 03, 2008: Message edited by: Clair McGray ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Clair,

Welcome to JavaRanch!

The classpath needs to include the current directory, or else javac won't look there for status/Bye.java . So

c:\temp> javac -cp .;c:\temp\jarfile.jar status\Hello.java


That "dot semicolon" adds the current directory to the classpath.
 
Campbell Ritchie
Marshal
Posts: 56527
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also try compiling Bye and Hello together:

c:\temp> javac -cp .;c:\temp\jarfile.jar status\Hello.java status\Bye.java
 
Clair McGray
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that works

Thanks alot
 
Clair McGray
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Also try compiling Bye and Hello together:

c:\temp> javac -cp .;c:\temp\jarfile.jar status\Hello.java status\Bye.java


I see! No wonder why it didnt work...

By the way, it works when i use my previous command and include both java files..
without ".;"

You've made my day, i've been trying and trying
 
Campbell Ritchie
Marshal
Posts: 56527
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not nearly as trying as us bartenders. And you're welcome. It is surprising how much annoyance you can get from such tiny things. What happens is that when you import a class and try to compile, the compiler seems to assume the imported class has already been compiled.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!