Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javac: directory not found: classes

 
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Still awaiting a reply from fellow forumers.

--
Ryan
 
author
Posts: 23956
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Replaced the colon at 'classes:.' with a semicolon. The error remains.
 
Henry Wong
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic