• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Package does not exist

 
lakshmanan anand
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two packages under my src directory.

  • com.example.web
  • com.example.model


  • I have BeerSelect.java in com.example.web
    and I have BeerExpert.java in com.example.model

    I first coded and compiled my BeerExpert class and it compiled without errors. But when i tried to compile BeerSelect class, package does not exist error comes..

    Here are my two classes





    The error when i try to compile BeerSelect class is


    Please help..
     
    Henry Wong
    author
    Marshal
    Pie
    Posts: 21518
    84
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Please help..


    How exactly are you compiling? The directory that you are in? The command line?

    Henry
     
    lakshmanan anand
    Greenhorn
    Posts: 22
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    here is the command that i give to compile

    javac -d classes src\com\example\web\BeerSelect.java

     
    Henry Wong
    author
    Marshal
    Pie
    Posts: 21518
    84
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    lakshmanan anand wrote:here is the command that i give to compile

    javac -d classes src\com\example\web\BeerSelect.java




    Unless, you have a classpath set, you are in the wrong directory. Without the classpath, javac will assume that the current directory is the class path, which in this case, is wrong.

    You need to be in the src directory and compile with

    javac -d ..\classes com\example\web\BeerSelect.java

    You may also have to recompile the other class too.

    Henry
     
    lakshmanan anand
    Greenhorn
    Posts: 22
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Henry Wong wrote:
    lakshmanan anand wrote:here is the command that i give to compile

    javac -d classes src\com\example\web\BeerSelect.java




    Unless, you have a classpath set, you are in the wrong directory. Without the classpath, javac will assume that the current directory is the class path, which in this case, is wrong.

    You need to be in the src directory and compile with

    javac -d ..\classes com\example\web\BeerSelect.java

    You may also have to recompile the other class too.

    Henry


    I went inside the src directory and compiled the class with your command, but still it gives me the same error... what else can i do ?
     
    lakshmanan anand
    Greenhorn
    Posts: 22
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    i just included the classes directory in my classpath.. and the problem was solved.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic