Hi,
The solution is Class/Classloader.getResource()/getResourceAsStream().
It should be not too difficult to find all occurances of file-access in
your project (with your IDE, with 'grep' or even with an editor) and a
bit more laborous to change the code in the apropriate way.
Hth,
Ingo
tiewknvc9 - 14 Aug 2006 16:19 GMT
Ah,
This I knew. My question is, is there a <b> website </b> that details
ALL of the code changes that one would need to make in order to make
the application jarred without errors?
Basically I dont want to go through each and every problem that arises
from jarring a file, I would rather work off of a reference, instead of
having to research each problem individually.
Thanks for the response though :)
> Hi,
>
[quoted text clipped - 6 lines]
> Hth,
> Ingo
gerry.hallahan@gmail.com - 14 Aug 2006 21:38 GMT
Check out JAR in Java Glossary as mindprod.com
http://www.mindprod.com/jgloss/jar.html
Tom Cole - 15 Aug 2006 13:14 GMT
Any resources that are not classes (i.e. text files, images, etc.) will
need to use the Classloader to get them. That's it. It's not that
complicated. No other changes needed. Classes will automatically find
themselves as the Classloader is already looking in the jar (since the
first class with the main method was loaded from it...)
> Hi,
>
[quoted text clipped - 6 lines]
> Hth,
> Ingo
> Is there a web page that details the java coding differences between
> running a java application in a directory structure, and running an
[quoted text clipped - 6 lines]
> However this fails when I jar the application. Of course it fails!
> It's in a jar file!
Backslashes.
Don't hard code your path separators - use java.io.File.separatorChar

Signature
simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/