Reputation: 4038
I have the following :
<mkdir dir="${build.dir}/serverNIO" />
<copy todir="${build.dir}/serverNIO" overwrite="true" verbose="true">
<fileset dir="resources/serverresources">
<include name="*.properties" />
</fileset>
</copy>
I want to copy the properties file from one folder to the other, all other tasks work fine except this one. Why does this happen? I do not even get any error message,and the file are in the location mentioned.
So when I try to run my server:
MacBook-Pro:ClientServerNio ramapriyasridharan$ ant run_server
Buildfile: /Users/ramapriyasridharan/Downloads/ClientServerNio/build.xml
init:
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/bin
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/dist
compile_server:
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[copy] Copying 1 file to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[copy] Copying /Users/ramapriyasridharan/Downloads/ClientServerNio/resources/serverresources/server.properties to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO/server.properties
init:
compile_common_server:
[javac] Compiling 3 source files to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
init:
compile_database_api:
[javac] Compiling 1 source file to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[javac] Compiling 5 source files to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
jar_server:
[jar] Building jar: /Users/ramapriyasridharan/Downloads/ClientServerNio/dist/server.jar
run_server:
[java] Exception in thread "main" java.io.FileNotFoundException: /ClientServerNio/bin/serverNIO/server.properties (No such file or directory)
[java] at java.io.FileInputStream.open(Native Method)
[java] at java.io.FileInputStream.<init>(FileInputStream.java:146)
[java] at java.io.FileInputStream.<init>(FileInputStream.java:101)
[java] at ch.ethz.rama.asl.server.MessageServer.main(Unknown Source)
[java] Java Result: 1
EDIT :
Now it suddenly seems to copy files, only thing is my server program cannot find the properties file,even tought its in the same directory, what should I do?
Upvotes: 0
Views: 110
Reputation: 7041
The Ant script copies server.properties to...
/Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO/server.properties
...but the Java program launched in the run_server
target is looking for the file at...
/ClientServerNio/bin/serverNIO/server.properties
To fix this, either:
<copy>
in the Ant script needs to copy server.properties to /ClientServerNio/bin/serverNIO
MessageServer.main
needs to change so it looks for server.properties under /Users/ramapriyasridharan
Upvotes: 1