DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2005

    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:

    URL url = getClass().getResource( fileName );
    File thisFile = null;
    	// Convert URL to URI and use to create File
    	thisFile = new File( url.toURI() );
    catch ( URISyntaxException e )
    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?

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

Similar Threads

  1. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 07:48 PM
  2. Creating Executeble Jar file
    By Sandeep in forum Java
    Replies: 0
    Last Post: 11-06-2001, 05:20 AM
  3. jar file
    By cesar in forum Java
    Replies: 0
    Last Post: 06-28-2001, 03:21 PM
  4. How to open a jar file
    By Lo in forum Java
    Replies: 4
    Last Post: 10-19-2000, 05:28 AM
  5. Replies: 2
    Last Post: 10-17-2000, 05: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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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