I am having a akka actors config file under resources,
src/main/resources/remote_app.conf
src/main/scala/actors/Notification.scala
I am loading the resources as below,
1.
val configFile = getClass.getClassLoader.getResource("remote_app.conf").getFile
val config_mediation = ConfigFactory.parseFile(new File(configFile))
actorSystem = ActorSystem("MediationActorSystem", config_mediation)
2.
val path = getClass.getResource("/remote_app.conf").getFile
val config_mediation = ConfigFactory.parseFile(new File(path))
actorSystem = ActorSystem("MediationActorSystem", config_mediation)
Both works fine when i execute from main program and getting the below logs,
[INFO] [11/21/2016 21:05:02.835] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://MediationActorSystem@127.0.0.1:7070] [INFO] [11/21/2016 21:05:02.838] [main] [Remoting] Remoting now listens on addresses: [akka.tcp://MediationActorSystem@127.0.0.1:7070]
I am creating a jar using sbt test:assembly and executing the main class as below SBT:
resourceDirectory in Compile := baseDirectory.value /"src/main/resources"
resourceDirectory in Test := baseDirectory.value /"src/main/resources"
java -cp <jar> <args>
Its not able to load the config file when i execute from jar. Anything am i doing wrong.