Created attachment 37951 [details] Apache JMeter embedded in IntelliJ IDEA 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.
The "* Do not use the JFrame as parent component when opening a dialogue window." needs to be moved the the needed changes as setMainFrame uses the MainFrame class and not JFrame.
"Do not use the JFrame as parent component when opening a dialogue window" doesn't seem to be a problem (needs more investigation). The mainFrame.getLocationOnScreen() is failing as the mainFrame is not visible. Also disable Zoom In and Zoom out actions in Embedded mode if we don't initialize JMeterUIDefaults.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5557