java.net.MalformedURLException: unknown protocol: rsrc

13,069

I finally figured it out. When using Eclipse and exporting a runnable jar file, make sure to choose under Library Handling:

Extract required libraries into generated JAR

That will fix this particular issue and probably many others.

Share:
13,069

Related videos on Youtube

AlbertoPL
Author by

AlbertoPL

I'm a software engineer living in the Bay Area. I enjoy web development and working with web languages. Currently I'm working with Asp.Net MVC and Node.JS with Express. My Java tutorial site for beginners

Updated on June 04, 2022

Comments

  • AlbertoPL
    AlbertoPL almost 2 years

    I get this;

    java.net.MalformedURLException: unknown protocol: rsrc
    

    I'm not entirely sure what to do about this unknown protocol. I am using simple RMI to communicate between two JVMs. Is it a jar that I am missing that contains this protocol and, if so, which one? I haven't found Google searches to be all that great for this issue.

    Any help would be appreciated. Thanks.

    EDIT2: To clarify, my RMI code works when running from Eclipse. It's when I export and use runnable jar files and such that it breaks.

    EDIT: Here's a code snippet:

    registry=LocateRegistry.getRegistry(
                    rmiServerAddress,
                (new Integer(rmiServerPort)).intValue());
    
    • Usman Saleem
      Usman Saleem over 12 years
      I believe eclipse used a customized classloader implementation which reads bundled jars and add them to class path. Try not to use "bundled jars" option to see if it helps. i.e. Copy libraries into sub folder option.
  • Dila Gurung
    Dila Gurung over 6 years
    Perfect. You saved me