[Qt-jambi-interest] Classpath bug?

Gunnar Sletta gunnar at trolltech.com
Thu Aug 21 07:03:29 CEST 2008


Dimitri Frederickx wrote:
> Hi,
> 
> I want to access a file inside of a specific jar file. To do this the 
> file name is "classpath:nameofmyjar.jar#nameofthefile". Under Mac OS X 
> with Qt Jambi 4.4.0 this works without a problem, but under Windows 
> the file can not be opened.
> 
> What I do is:
> 
> QFile file = new QFile("classpath:demo-file.1.0.0.jar#plugin.xml");
> if(!file.open(OpenModeFlag.ReadOnly)) {
> 	// I come in this loop, so the file can not be read!
> }
> 
> Can you reproduce this problem? Is this a bug?

Hi Dimitri,

I'm not able to reproduce this with 4.4.0 on windows using a .jar file 
in the local directory and the code.

<snip>
import com.trolltech.qt.core.*;

public class FindInJar {

     public static void main(String args[]) {

         QFile f = new QFile("classpath:the.jar#file.txt");
         if (!f.open(QFile.OpenModeFlag.ReadOnly)) {
             System.out.println("file not opened...");
         } else {
             System.out.println(f.readAll().toString());
         }
     }
}
</snip>

Anything I might be missing?

best regards,
Gunnar



More information about the Qt-jambi-interest mailing list