MR AND
MR AND

Reputation: 396

Problem setting class path without shortcut directory folder in java manifest

Earlier shortcut was allowed in a server so the code shown below worked fine for executing a jar file

Manifest-Version: 1.0
Sealed: true
Main-Class: org.test.MainClass
Class-Path: /PROGRA~1/Testfolder/hibernate3.jar
 /PROGRA~1/Testfolder/org.springframework.web-3.1.1.RELEASE.jar

Now the system does not allow shortcut directory folder I have to use the full path and system does not identify such path.

Manifest-Version: 1.0
Sealed: true
Main-Class: org.test.MainClass
Class-Path: /Program Files (x86)/Testfolder/hibernate3.jar
 /Program Files (x86)/Testfolder/org.springframework.web-3.1.1.RELEASE.jar

How should I specify such absolute path in a manifest file.

Upvotes: 0

Views: 194

Answers (1)

zaerymoghaddam
zaerymoghaddam

Reputation: 3117

The reason is that you have blank spaces in your addresses. You should either put them in a path without space or replace them with %20. So your Class-Path entry would look like this:

Class-Path: /C:/Program%20Files%20(x86)/Testfolder/hibernate3.jar

I don't have access to a Windows machine now, if it doesn't work it could be due to the way Windows partition name should be presented in URL. You can also try and address that starts with file:///C:/ too (or maybe file:///C/.

Each entry in the Class-Path entry would be considered as a URL so you should escape them the way you escape blank space in URL and they should have a protocol.

Upvotes: 1

Related Questions