Problems with URI in a jar file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Problems with URI in a jar file

Threaded View

  1. #1
    Join Date
    Sep 2005
    Posts
    10

    Problems with URI in a jar file

    Part of an application that I've been working on gets a file from the local machine with the following code:

    Code:
    URL url = getClass().getResource( fileName );
    File thisFile = null;
    try
    {
    	// Convert URL to URI and use to create File
    	thisFile = new File( url.toURI() );
    }
    catch ( URISyntaxException e )
    {
    	e.printStackTrace();
    }
    To simplify things, I've put the files in the same package directory as the classes that read and write to them. This works fine when run from Eclipse and when run from the command line. However, once I put all the package directories in a jar file with a manifest that specifies the main class I get the following error when I run it (using java -jar filename.jar)

    Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
    The top of the stack trace output refers to the line of code highlighted in red. Does anyone know what this error means?

    Thanks.
    Last edited by alcdotcom; 09-29-2005 at 08:23 AM.

Similar Threads

  1. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 08:48 PM
  2. Creating Executeble Jar file
    By Sandeep in forum Java
    Replies: 0
    Last Post: 11-06-2001, 06:20 AM
  3. jar file
    By cesar in forum Java
    Replies: 0
    Last Post: 06-28-2001, 04:21 PM
  4. How to open a jar file
    By Lo in forum Java
    Replies: 4
    Last Post: 10-19-2000, 06:28 AM
  5. Replies: 2
    Last Post: 10-17-2000, 06:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center