Announcement Announcement Module
Collapse
No announcement yet.
Problems to run a standalone app Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems to run a standalone app

    Hello everyone,

    I'm working on a standalone application, it was built with spring libs on plain java project with eclipse. Where all its functionality is working fine. But, when I created a JAR file in order to execute it by command line it did not work, I got this error:

    Code:
     WARN | 2013-07-14 00:32:09,908 | PathMatchingResourcePatternResolver | Cannot search for matching files underneath URL [rsrc:com/lab/subcms/bus/]
     because it does not correspond to a directory in the file system
    java.io.FileNotFoundException: URL [rsrc:com/lab/subcms/bus/] cannot be resolved to absolute file path because it does not reside in the file syst
    em: rsrc:com/lab/subcms/bus/
            at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:205)
            at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:52)
            at org.springframework.core.io.UrlResource.getFile(UrlResource.java:169)
            at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternRes
    The workaround I found for it was following this steps:

    Unpack the JAR file by using this command line: jar xf mypackage.jar

    Once unzipped it, I created a batch file with this structure:
    set classpath= ... all jar dependecies (full path)
    java /path_package/MainClass

    And it works!

    The point here is that this is not the way it should work, I should be able to get it works by running java -jar mypackage.jar. But in that case I'm getting the error mentioned before.
    Why does this not work? Can anyone give me a hand?

    Thanks in advance,

    Luis.

  • #2
    Creating a jar only adds your own classes... To run the application you need to add all the classes you used during development time. Without it isn't going to work. Also not sure what you are trying to do but apparently the file cannot be found as it is expected to be on the file system and not inside a jar file.

    Comment


    • #3
      Thanks for replying. I included all the files used by me during development time, I checked it before reporting this issue. This works in eclipse but it does not by command line (java -jar mypackage.jar). It seems to be that there is a problem when it is exported from eclipse. I'm not sure what's going on here. That's why I'm asking for help. If I can get it works I'll let you know.


      If anyone can provide any ideas would be great!
      Regards,

      Luis.

      Comment

      Working...
      X