How is this a weird issue? URL != file. Just because some URLs can be converted to valid files doesn't mean all can. If you need the file contents use getResourceStream. If you need information on the file, use the java.util.zip package

Sent from my iPod

On Oct 26, 2008, at 4:34 AM, "Jeffrey Williams" <[EMAIL PROTECTED] > wrote:

Hi,

I am having an issue with maven and getting a file from within my
executable jar project.

I have the following code in my main

       URL url = this.getClass().getResource("/comma.txt");
       File commaFile = new File(url.getFile());

The issue is that the url that is found when executing the jar has an
exclamation mark in it. ie

/home/jeffxor/workspace/cyrus/target/cyrus-0.0.1-SNAPSHOT.jar!/ comma.txt

you will notice it after the jar file name. Obviously when I then try
to get a file I get FileNotFoundException.

I have used this code on other machine and have had no issue. I am
using Ubuntu and maven 2.0.8 and java 1.6., I have searched the
internet but have got no results and I am out of ideas.

Any help would be great.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to