aspose file tools*
The moose likes Beginning Java and the fly likes javac -classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac -classpath "white spaces"" Watch "javac -classpath "white spaces"" New topic
Author

javac -classpath "white spaces"

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I have noticed that if I try and use the -classpath option when compiling or running a java application, and if my classpath is something like "c:\Document and Settings\gdboling\My Program..."
I get an error because of the white spaces in the directory names. Is there a work around for this?
[ June 06, 2002: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

Is the command line itself failing, or is the command starting and then barfing on the classpath?
If it's the CLI that's tripping over the space you could try wrapping the parameter in quotes (") which should prevent it from trying to break the parameter at the space. Or, you could always resort to the crappy PROGRA~1 notation for the folders that contain spaces.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
On my Windows ZP system, I experience the same problem which is resolved by enclosing the classpath setting in double quotes. Note that when amending an already established classpath, everything must be surrounded with the double quotes. This is what I'm trying to say:
javac -classpath "%classpath%;SomeAdditionalPaths" Whatever.java
Any luck?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Thanks Dirk, i will try that. I think that will work though. It makes sense.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javac -classpath "white spaces"