[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.m2e] Re: How to write to /src/main/resources?

First, files in "src/main/resources" will be added to your application jar so you can always read them (in Java) from Class#getResourceAsStream. But you can't write to there!

And your application shouldn't rely on source code folders. "user.dir" happens to be the location where application B is launched, but what about when you build the jar and ship it to someone else? How about using System.getProperty("java.io.tmpdir")?

-Will

"JS" <asd@xxxxxxx> wrote in message news:gu3kas$7q5$1@xxxxxxxxxxxxxxxxxxxx
I have an application in a maven module A that needs to write a file to a tmp folder during runtime. But the application is called from another module B which means that:

System.getProperty("user.dir")

refers to module B's location. I have created the tmp folder in:

/src/main/resources/tmp

under module A (it should not be placed in module B's resources). But how do I get that path?



does not
"Igor Fedorenko" <igor@xxxxxxxxxxxxxx> wrote in message news:gu2vo0$uhk$1@xxxxxxxxxxxxxxxxxxxx
Can you explain what you are trying to achieve?

--
Regards,
Igor


JS wrote:
I have installed maven in eclipse on Vista 32.

I have made a tmp folder in /src/main/resources:

/src/main/resources/tmp

Now I want to write some files to this folder, but how do I get the full path?