I'm automating a Swing GUI application using JRuby and Jemmy library. The application takes arguments when launching. I was able to launch the application from command line by passing the arguments after the Main Class name. Is there a way to do the same using Jemmy in JRuby?
From command line
java -cp CLASSPATH org.sample.MainApplication arg1 arg2
From Jemmy documentation
ClassReference newApp = ClassReference('org.sample.MainApplication'); newApp.startApplication();
What I've tried in JRuby
main_app = ClassReference.new('org.sample.MainApplication')
main_app.start_application()
After much trial & error I figured out the issue. I was sending incorrect format for arguments.
main_app.start_application(['arg1','arg2'].to_java(:string)) did the trick.