• 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

File not getting imported

 
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run the first application in MVC in HFSJ.
Some how it's not recognizing the first import statement .
I am getting the error "package com.example.model does not exist"

Here's the code :

BeerSelect Java file



BeerExpert File




The directory structure is

beerV1 --> classes --> com --> example -->web -->
beerV1 --> classes --> com --> example -->model --> BeerExpert.class

beerV1 --> src --> com --> example -->web --> BeerSelect.java
beerV1 --> src --> com --> example -->model --> BeerExpert.java


The command line
" javac -classpath "C:/program files (x86)/Apache Software Foundation/Tomcat 5.5/servlet-api.jar" -d classes src/com/example/web/BeerSelect.java"
I am executing it from the beerV1 folder.


I know it's something small and silly . Just can't pin it
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you try to compile BeerSelect.java your classpath must contain 2 entries: one for the servlet api and one for the already compiled BeerExpert class. Your classpath just contains an entry fpr the servlet api, so that's why it is not compiling.

javac -cp classes;"C:/program files (x86)/Apache Software Foundation/Tomcat 5.5/servlet-api.jar" -d classes src/com/example/web/BeerSelect.java should do the trick
 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot ! That did the job
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic