Iam a beginer programmer java on Debian Linux 12 (Later may be on FreeBSD 14 too) and I would like to make an small application a Java Swing launcher to launch some java web servers like Jetty, Glassfish and Wildfly for webdevelopment and to run some HTML 5 templates (to test them how they run in each Java Web Server).I found two Java source codes (one to make the Java Swing interface and one which run the unix shell script) the only thing is that I don't know how to integrate or how to make java to run the unix command inside of a Java Swing app. Is it possible to that ? and also is there any way to create a new button to stop the process of a Java Server Launcher? , here is the code of the Java Server Launcher :
import java.awt.*;
import javax.swing.*;
public class JavaServerLauncher {
static JFrame frame;
static JPanel panel, panelData;
static JMenuBar menuBar;
static JMenu menuFile, menuSetting, menuOption;
static JMenuItem itemNew, itemOpen, itemSave, itemPrint, itemOption, itemClose, itemView, itemReports;
static JToolBar toolBar;
static Icon iconMenu = UIManager.getIcon("html.pendingImage");
static JButton barSave, barEdit, barClear, barDelete;
static ButtonGroup group;
static JRadioButtonMenuItem subFont1, subFont2, subFont3, subFont4, subFont5;
static JCheckBoxMenuItem checkPrefer;
static JLabel label;
static JTextField textFirst, textMiddle, textLast;
static JCheckBox checkGender;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
gui();
}
});
}
public static void gui() {
frame = new JFrame("Java Server Launcher for Debian Linux");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(550, 300);
JavaServerLauncher myMenu = new JavaServerLauncher();
myMenu.myMenuBar();
myMenu.myToolBar();
frame.setJMenuBar(menuBar);
frame.add(toolBar, BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
}
public void myToolBar() {
toolBar = new JToolBar(JToolBar.HORIZONTAL);
frame.add(toolBar);
barSave = new JButton("Apache TomCat", iconMenu);
toolBar.add(barSave);
barEdit = new JButton("Jetty Server", iconMenu);
toolBar.add(barEdit);
barClear = new JButton("GlassFish 7", iconMenu);
toolBar.add(barClear);
barDelete = new JButton("Wild Fly", iconMenu);
toolBar.add(barDelete);
barDelete = new JButton("Turn Off", iconMenu);
toolBar.add(barDelete);
}
public void myMenuBar() {
menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
}
}
What I have tried:
I have checked google it in some web pages but not answer, some users told me Process Builder but I cannot find any source code with Process Builder with Java Swing.