0

I created a file deleteitems.java inside the directory servlet.

There is a file called db.java in the directory 'dao.

In deleteitems.java I imported db.java file(import dao.db)

This is the directory structure Classes

├───dao
│       db.java
│
└───servlet
        deleteitems.java

How to compile in command line I'm inside servlet directory. It throws me the error package dao does not exist

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
venugopal
  • 263
  • 1
  • 7
  • 14
  • You need to either explicitly specify the classpath, or run the compiler from the parent directory. – Sneftel Jul 18 '15 at 18:26

2 Answers2

0

Your anser is here.

If you using javac you must set classpath. In the theard that i gave above, janos explins in detail what and how

Community
  • 1
  • 1
Jerzy Drożdż
  • 438
  • 6
  • 8
0

Make sure you have declared package declaration on db.java "package dao;".

cgeek
  • 55
  • 9