• 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

using the �classpath option in the javac command

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I�m trying to use the �classpath option in the javac command from the command line in windows. My problem is when the path has spaces in it. How do I get to a directory such as the following: �javac �classpath C:/Program Files/Apache Software Foundation/Tomcat 5.0�?

Thanks
 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use double quotes. C:\"Documents and Settings" etc
On a Windows CMD prompt you could just use the TAB key as well.

eg. c:\do <press tab> and the entire path is printed automatically.

Hope this helps.
Amit
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first level of the path is printed within quotes with this method. Then you have to type the rest.

Another way to do it is to use Windows Explorer to navigate to the path you want to get your classes from, copy the path from the address bar, then paste it into a command line in a batch file. Now you have the batch file that you can run any time you need. If you need to make modifications, say to the class path, you can copy the line in the batch file, remark the original out so that you still have it if you ever need it, then run the batch file from the command prompt or by double-clicking it in Windows.
[ October 20, 2004: Message edited by: Jeff Bosch ]
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it, thanks. I used the quotes method and it worked like a charm.

I'm not quit sure how to use the batch file method, but I'm going to give it a try and see what happens.
 
Jeff Bosch
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quick steps:

1. Create a new text file in Notepad.

2. Add the javac line, just like you would in your dos session.

3. Save the file as something like "CompileJava.bat".

You can now run the batch file from the dos prompt or double-click it in Windows. There's no advantage to doing this for only one compilation, but how many programs have you worked on that only required compilation once? By doing it this way, you don't have to reopen a dos session or re-type the command. I use this method for compilation and also for running a Java app under a JVM of my choice.

You can also have multiple compilation configurations in the batch file, one for each line, then add "REM" in front of the ones you don't use. This is the same as commenting out a line of code in a source file. To modify your compilation configuration, you just move one of the REMarks from the line you want to run to the currently unREMarked line. You can also copy, paste, then modify any line. Very flexible, very repeatable.
[ October 20, 2004: Message edited by: Jeff Bosch ]
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff, you rock.
 
Jeff Bosch
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Du-u-de!

(Translation: Thank you!)
[ October 20, 2004: Message edited by: Jeff Bosch ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic