Flexible File Writer doesn't respect "~/" relative file prefix option

62 views
Skip to first unread message

Ray Oei

unread,
Dec 8, 2015, 4:41:46 AM12/8/15
to jmeter-plugins

In Flexible File Writer a filename prefixed with "~/" is not created.
Instead an error is logged:

2015/12/08 10:32:59 ERROR - kg.apc.jmeter.reporters.FlexibleFileWriter: Cannot open file ~/cpu.txt java.io.FileNotFoundException: ~\cpu.txt (The system cannot find the path specified)
    at java
.io.FileOutputStream.open0(Native Method)
    at java
.io.FileOutputStream.open(FileOutputStream.java:270)
    at java
.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java
.io.FileOutputStream.<init>(FileOutputStream.java:133)
    at kg
.apc.jmeter.reporters.FlexibleFileWriter.openFile(FlexibleFileWriter.java:185)
    at kg
.apc.jmeter.reporters.FlexibleFileWriter.testStarted(FlexibleFileWriter.java:79)
    at org
.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:214)
    at org
.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:336)
    at java
.lang.Thread.run(Thread.java:745

This is, however, default behaviour in Jmeter (see http://jmeter.apache.org/usermanual/component_reference.html - Save Responses To File - Filename Prefix).

"Versions of JMeter after 2.4 also support paths relative to the directory containing the current test plan (JMX file). If the path name begins with "~/" (or whatever is in the jmeter.save.saveservice.base_prefix JMeter property), then the path is assumed to be relative to the JMX file location"


Vincent Daburon

unread,
Dec 9, 2015, 9:13:16 AM12/9/15
to jmeter-plugins
Hi,
You could use
String homeDir = System.getProperty("user.home");

or ${__P(user.home)}/cpu.txt

Regards.
Vincent D.
Reply all
Reply to author
Forward
0 new messages