• Post Reply Bookmark Topic Watch Topic
  • New Topic

javac: directory not found: classes  RSS feed

 
Ryan McClain
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Still awaiting a reply from fellow forumers.

--
Ryan
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Ryan McClain
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Replaced the colon at 'classes:.' with a semicolon. The error remains.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ryan McClain
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

@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
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!