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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with classpath" Watch "Problem with classpath" New topic
Author

Problem with classpath

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
An example that doesn't work OK:
C:\Temp\Program Files\Java
java -jar myJAR.jar
java.security.AccessControlException: access denied (java.io.FilePermission \C:\Temp\Program Files\Java with Files\Java\myJAR.jar read)
An example that works OK:
C:\Temp\Java
java -jar myJAR.jar

It seems that starting my myJAR.jar archive fails when started in a folder that has a path containing spaces. How could I overcome this problem. I need to use folder ith spaces in their names!
Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
You simple need to type this "C:\Program Files\Java\bin\java -jar myJar.jar" this will solve the space issues.
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Which OS you are using?
-------------------
Sainudheen
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
I'm using win 2000 Professional.
I've already tryed with quotation marks, but that failed.
--------------------------
One very concrete example:
Extract Batik-1.5 zip archive somewhere inside "Program Files" folder,
and try to run batik-squiggle.jar tool.
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Hi
If you mean to say you are unable to navigate to a directory which has a space in its name, you may open the DOS prompt using cmd instead of command.
---------------------
Sainudheen
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Or you can substitute a ~1 after the first six letters. For example:

C:\Temp\Program Files\Java>java -jar myJAR.jar

becomes

C:\Temp\Progra~1\Java>java -jar myJAR.jar


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Try this.
Here is what I have done:
First, I had opened Command window and changed directory like:
C:\>cd Program Files
C:\Program Files>cd Java
C:\Program Files\Java>cd Batik-1.5
C:\Program Files\Java\Batik-1.5>java -jar batik-squiggle.jar
An exception occurs.
But if I extract Batik-1.5.zip archive into C:\Temp directory, everything works OK:
C:\>cd Temp
C:\Temp> cd Batik-1.5
C:\Temp\Batik-1.5>java -jar batik-squiggle.jar
The batik-squiggle application runs OK.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with classpath