Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Incorrect basedir in Ant build

Help
2012-12-18
2013-08-21
  • Victor Denisov
    Victor Denisov
    2012-12-18

    I'd recently tried to incorporate launch4j into my Ant build process (I'd used to manually generate new .exe files from the GUI before that). Unfortunately, launch4j target failed during invocation of LD, telling me that it couldn't find appropriate libraries. To make a long story short, I'd narrowed this issue down to the following lines in Util.java:

    URI uri = new URI(Util.class.getClassLoader()
        .getResource(Launch4jProperties)
        .getFile());
    
    String path = uri.getPath();
    if (path.startsWith("file:")) {
            //Compute basedir
            ....
    } else {
           return new File(".");
    }
    

    Basically, in my environment (Windows 7 64-bit, JDK 1.7.0_09 64-bit), I don't get a path which starts with "file:" (I get "/c:/Dev/lib/launch4j/launch4j.jar!/launch4j.properties" instead), so the base dir is always being set to current dir - which works for a stand-alone GUI application, but fails for Ant target.

    Hope this would be fixed in a future launch4j release.

    Regards,
    Victor Denisov.

     
  • Scott Plante
    Scott Plante
    2013-03-07

    Ah ha, I came to the same conclusion. I wish I'd seen this before. I'm going to add the following error message so this might turn up on some additonal searches:

    net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "./bin/windres": error=2, No such file or directory

    I added a blurb similar to yours to the bug I found (3606889).

     
  • Grzegorz Kowal
    Grzegorz Kowal
    2013-08-21

    Fixed in 3.0.1-beta2.