I have a java application, a scala script and a jar library.
The Java application is a Jframe application.
THe scala script simply adds a button to a JFrame.
The jar library is just a normal java class contains a HashMap<String, JFrame>.
I imported this jar file to my java application and my scala script also has reference to it.
What I need to achieve is when the java application starts, it set the HashMap <"main",frame> and then execute the scala script. the script reads the HashMap and retrieve the JFrame from the Hashmap and then add a button to the retrieved JFrame.
The java program successfully put the jframe into the Hashmap. I use Runtime.getRuntime().exec to run the scala script but the script reads "null" from the Hashmap.
Is this because the scala script is running in a separate process? please could anyone advise how could achieve what I need? Thanks
Thanks. The reason why I did not use scala class directly is because I want to make the Java application configurable.. i.e. if the scala script exists in a certain directory, the java program executes it and then the scala script adds a button to the java application. if the script does not exist in the directory, the java program will not do anything...