JMenuItem compileRunItem = new JMenuItem("Compile .java file and run");
compileRunItem.setFont(scalaExec.Interpreter.GlobalValues.puifont);
compileRunItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GlobalValues.extensionClassLoader = new ExtensionClassLoader(GlobalValues.ScalaSciClassPath);
JavaCompile javaCompileObj = new JavaCompile();
ExtensionClassLoader extClassLoader = GlobalValues.extensionClassLoader;
String selectedValue = scalaLabPathsListener.selectedValue;
String pathComponent = selectedValue.substring(0, selectedValue.lastIndexOf(File.separatorChar));
GlobalValues.selectedExplorerPath = pathComponent;
String javaFile = selectedValue;
String packageName = ""; // do not place the new Java Classes within some package !!
if (selectedValue.indexOf(".java")!=-1) { // file is a Java source file
boolean compilationResult = javaCompileObj.compileFile(javaFile);
if (compilationResult == true) // success
{
GlobalValues.scalalabMainFrame.explorerPanel.updatePaths();
System.out.println("Compilation success for file "+packageName+"."+javaFile);