• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Package does not exist

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
     
    author
    Posts: 23907
    142
    jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 23907
    142
    jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i just included the classes directory in my classpath.. and the problem was solved.
     
    what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
    reply
      Bookmark Topic Watch Topic
    • New Topic