Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

pacakge does not exist  RSS feed

 
Kannan Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code, called BeerSelect.java in

C:\myprojects\beerv1\src\com\example\web



Then I have another java program BeerExpert.java in C:\myprojects\beerv1\src\com\example\model.

When I compile BeerSelect.java, I got the error message
package.com.example.model does not exist. I cheked the dir structure and it looks ok to me. Please help me to fix this. Thanks.
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try compiling all files in import com.example.model.*; , and check if you still get the error message.
 
Kannan Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that already. I got the same error message. Actually, this is the example given in HFSJ at page 84. Anybody had this problem before? Please help. Thx.

[ July 23, 2005: Message edited by: Kannan Raju ]
[ July 23, 2005: Message edited by: Kannan Raju ]
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you named the package in which BeerExpert.java sits as,

That's what your error message shows right, or is it just a typo ? if not try naming it as com.example.model.
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi



Did you check the existence of model directory in your com/example/web directory ?

bye for now
sat
 
Kannan Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satish,

No, model dir is not in com/example/web.The web and model directories are under example.

But, I copied model dir under com/example/web also. Same error message. It should be simple fix. I am not sure.
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am sorry. I misunderstood ur words.

Now it will work try this


bye for now
sat
 
Kannan Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satish,

I tried as you suggested, and it gives compile error at line 19 as
"cannot find symbol BeerExpert". So I sent you an email with two attachemets if these two java files. Please check your email and let me know.

Thanks
Kannan
 
Kannan Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should I add classpath variable when I compile this file to indicate my package?
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following as an example
This is the java programs location D:\javaprogs\new\com\example

go to example directory in the console and enter set CLASSPATH=D\javaprogs\new

eg D:\javaprogs\new\com\example> set CLASSPATH=D\javaprogs\new

after completing this setting. type javac web/test.java in your console


eg D:\javaprogs\new\com\example> javac web\test.java

It will work
bye for now
sat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!