SourceForge has been redesigned. Learn more.
Close

Packing devices inside .jar archives...

Zigor
2004-06-25
2004-07-01
  • Zigor

    Zigor - 2004-06-25

    Is it possible to pack a device inside a jar file and run it from there? How can I access the XML files inside the jar? Has anybody done something similar?

    Thanks,

    Zigor.

     
    • Stefano Lenzi

      Stefano Lenzi - 2004-07-01

      You can access to XML using the following method:

      Image you have the following struct in your jar:
      ./description/root.xml
      ./MyDevice.class

      InputStream xmlInputStream =
             MyDevice.class.getResourceAsStream(
                    "description/root.xml"
             );

      Let you access to ./description/root.xml within jar from any java class, even classes outside jar

       

Log in to post a comment.