| Author |
javac: directory not found: classes
|
Ryan McClain
Ranch Hand
Joined: Nov 27, 2010
Posts: 44
|
|
Hello
I am trying to deploy a web app (servlets) but it does not seem to be working.
I have the following commands:
x:\> c:\apps2\jdk1.6\bin\javac -cp x:\apps2\Apache TomCat\lib\servlet-api.jar;classes:. -d classes x:\projects\beerV1\src\com\example\web\BeerSelect.java
javac outputs the following error:
javac: directory not found: classes
What 'classes' is it referring to?
How can I fix this so that it copies it into the correct classes directory within the development environment project structure?
Thank you
OS: Windows XP Pro
|
 |
Ryan McClain
Ranch Hand
Joined: Nov 27, 2010
Posts: 44
|
|
Still awaiting a reply from fellow forumers.
--
Ryan
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
Windows uses the semicolon to separate the different class paths. Unix uses the colon. And in your example, you are using both -- which is obviously wrong.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Ryan McClain
Ranch Hand
Joined: Nov 27, 2010
Posts: 44
|
|
Replaced the colon at 'classes:.' with a semicolon. The error remains.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
Ryan McClain wrote:
Replaced the colon at 'classes:.' with a semicolon. The error remains.
Can you show us the contents of the "x:\classes" directory?
Henry
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
The (or at least another) problem is with the spaces in your path. Currently your command has the following parameters:
- -cp
- x:\apps2\Apache
- TomCat\lib\servlet-api.jar;classes:.
- -d
- classes
- x:\projects\beerV1\src\com\example\web\BeerSelect.java
To group the 2nd and 3rd you must quote them:
x:\> c:\apps2\jdk1.6\bin\javac -cp "x:\apps2\Apache TomCat\lib\servlet-api.jar;classes:." -d classes x:\projects\beerV1\src\com\example\web\BeerSelect.java
Note that the entire class path needs to be quoted, not just the one folder inside the class path. That's because you pass this as one parameter to the JVM which then splits it up.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Ryan McClain
Ranch Hand
Joined: Nov 27, 2010
Posts: 44
|
|
Compilation success.
It appears I had to cd to the project directory (x:\projects\beerV1), otherwise it would not find the relative path classes within the project structure. I thought classes was a standalone parameter.
Fixed now.
--
Ryan
|
 |
Ryan McClain
Ranch Hand
Joined: Nov 27, 2010
Posts: 44
|
|
@Rob
Already knew that, but forgot to put the quotes when I posted.
For further reference: I have had a lengthy (~6 years) experience with programming. Though it has been through IDE's mostly, that is why I was not so flexible with compiling through commandline even though I have tried it before.
--
Ryan
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
That's why we mostly advice beginners to start with the command line and move to an IDE when the command line is under control
|
 |
 |
|
|
subject: javac: directory not found: classes
|
|
|