Add option to have JMeter UI embedded in another application
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
**Anthony Goubard** ([Bug 65449](https://bz.apache.org/bugzilla//show_bug.cgi?id=65449&redirect=false)):
At the moment, JMeter assume that it is started with a JFrame or as non gui mode.
It would be nice to have an option to start JMeter in embedded mode to have it included in another application. For example in a Java IDE.
Here are the changes needed to make JMeter embeddable:
* New "embedded" start-up option (JMeter.java)
* Parse the option in JMeter.java#start
* Do not initialize JMeterUIDefaults and look and feel in JMeter.java#startGui
* Do not show the JFrame in JMeter.java#startGui (setLocationRelativeTo, setVisible, toFront)
* Do not show or disallow the following menu:
** File -> Restart
** Options -> Look and Feel
* Add a method to JMeter.java to get the JFrame or the JRootPane
* Do not call System.exit if the start-up fails
Nice to have but could be solved with workaround:
* Do not use the JFrame as parent component when opening a dialogue window.
** Workaround calling GuiPackage.setMainFrame with frame of the main application.
* Do not assume that the context class loader of the current thread or of the event dispatch thread contains the classpath like for example done in the menu creation and searching for plug-ins. Prefer getClass().getClassLoader() or MyObject.class.getClassLoader() in a static context.
** Workaround change the context class loader of the thread starting JMeter and of the Event Dispatch Thread which can be dangerous as the EDT is used everywhere in an IDE for example.
* NewDriver.java should first check the "jmeter.home" system property, as if the main application is started from a main Jar file, NewDriver assume it's the ApacheJMeter.jar which is not the case.
** Workaround change the "java.class.path" system property to have at least 2 entries before starting JMeter.
Created attachment [jmeter-running-in-intellij-idea.png](https://apache.github.io/jmeter-bugzilla-attachments/49/65449/37951/jmeter-running-in-intellij-idea.png): Apache JMeter embedded in IntelliJ IDEA

OS: All
Contributor guide
Assessment
This issue has not been assessed yet.