I'm hitting a strange issue when trying to run a swing project from Gradle from within a VM (hypervisor being kvm).
The code runs fine on every attempt from the host OS, yet hangs in the jframe.pack()
method most times when run from within the guest. I am assuming the issue is something along the lines of thread synchronization.
As with most swing apps, it is unrealistic to attempt to post the code to show here.... but I can point to it in GitHub
I'm not playing with threads in any huge way otherwise, basically just letting swing manage itself. I'm also giving the guest ample resources and don't have any issues running any other application.
I'm not teribly familiar with the nuances of the threading going on here, what could be the source of the issue? I'm not doing anything fancy in the way of creating my own threads, etc. I am simply setting up my ui as one would "normally", and letting swing handle its own threading.
Host:
- CentOS 8 stream
- 8 core/ 32g ram
- Java 8
Guest:
- Ubuntu 19.10
- allocated 8 core/ 16g ram
- Java 8
A simplified walk through of how the swing app is setup:
class Runner(){
private Gui gui;
public runGui(){ //what is run to run the gui
gui = new Gui();
}
}
// partially setup with Intellij's form builder
class Gui(){
private JFrame mainFrame;
//many other member variables and functions
public void Gui(){
//general setup of GUI code. generation of elements, event binding, etc
this.mainFrame = new JFrame();
...
// pack and open
this.mainFrame.pack();
this.mainFrame.setVisible(true);
}
{
//intellij autogenerated form builder. Standard setup code.
$$$setupUI$$$();
}
}