I have to customize the reports.html file created inside jbehave\view folder. Is there any example available for the same.
You must check this official reference.
I managed to customize it by simply copying the jbehave-reports.ftl file from the JBehave jar into my test resources under the ftl directory. JBehave obviously reads the template from classpath at ftl/jbehave-reports.ftl, so the project-local file overrides the file from the jar.
Related
I have set up my artificat so it appropriately builds a jar file and includes the source, manifest file etc. However, it does not include the class file. Is there a way to include that as well?
Thanks!
Class files are included by default into the jar artifact you create for the module.
It's controlled by the compile output entry in the artifact:
You may not have the classes included if the source roots are misconfigured or the files are excluded from compilation, or for some other reasons described in this answer.
See this answer for the sample project link that you can download and verify the correct project/artifact configuration so that you can compare it with yours and find what's wrong.
This question has been covered here before, but the only solutions I could find were in relation to a project using Ant or Maven. I am using neither. Here is the situation:
I have some application parameters in a properties file. This file is located in my Eclipse project (but in the src folder) and used when I run the application from Eclipse. In addition, I would like the application to also run as an executable jar file, in which case the user can provide the name of a properties file to use in a command line parameters.
The problem now is that the properties file from the project is always packaged into the executable jar and therefore the user is not able to easily modify the properties (yes, I know that (s)he could unzip the jar, but I want to avoid the extra steps).
How can I prevent the properties from being packages into the executable jar file?
Cheers,
Martin
Create a executable jar without properties file in it. Place both jar and properties file in a folder. Now add little code in your main program which should look for a properties file in the same folder and get the complete path of it. And then you can do something like this
System.getProperties().load(new FileInputStream(completepath));
So now your properties will be loaded into system properties with out affecting the actual system properties. You can access your properties by System.getProperty("Propertyname");
Hope this helps. Let me know if you have more questions.
I am using a java jar dependency that requires a certain property file to be on the classpath. I can't for the life of me figure out how to add this folder/file to the classpath. I am using play 2.0.
I have added the config.properties file to both the /conf directory and have tried to add it to the root of my app source folder. The file does not seem to be recognized by the dependency.
BTW: play 2.0 uses sbt to compile and run the application so maybe something there could help?
Any ideas?
You should be fine if you put the property file where your class files are. When you use SBT you probably use either:
The project root directory as source directory. In this case just put your property file into the root directory.
Or the maven layout, so your normal classes are under src/main/scala In this case put your property file under src/main/resources
Although the answer of Jens Schauder should solve your issue, you may want to try to add the file to the lib folder.
Play 2.0 won't remove files manually added in there (at least it doesn't at the time I'm writting this!) and that folder should be included into the classpath automatically.
In which location I should put any file in Netbeans project directory structure?
Also in the code how should I give the path(absolute or relative) to that file?
Thanks
If it is about Java,
I would suggest you to put it in default package , It would be directly available in classes folder after building, so you can directly access it from classpath.
Here is sample
I have an application which is making use of a .jar file and a .properties file which must reside in the same directory as where the .jar file lies. On a normal java application, this works fine, however I'm building an Eclipse plug-in. I've tried attaching the .properties everywhere, in the classpath, build path, putting them in the same folder and calling the jar file from there (this gives an obsure error) and I've even tried putting the .properties file inside the .jar file even.... but no luck. Any ideas how this could be done please?
Thanks and regards,
Krt_Malta
Perhaps the FileLocator class will help you. The FileLocator provides a find method where you can specify the Bundle and a resource to look for.
Ingo