public static boolean haveSwing() { // classExists caches info for us return classExists( "javax.swing.JButton" ); }
public static boolean haveSwing() { // classExists caches info for us return classExists( "javax.swing.JButton" ); }
public static void main( String args[] ) { if ( !Capabilities.classExists( "bsh.util.Util" ) ) System.out.println("Can't find the BeanShell utilities..."); if ( Capabilities.haveSwing() ) { //bsh.util.Util.startSplashScreen(); try { new Interpreter().eval("desktop()"); } catch ( EvalError e ) { System.err.println("Couldn't start desktop: "+e); } } else { System.err.println( "Can't find javax.swing package: " +" An AWT based Console is available but not built by default."); //AWTConsole.main( args ); } } }
public static void main( String args[] ) { if ( !Capabilities.classExists( "bsh.util.Util" ) ) System.out.println("Can't find the BeanShell utilities..."); if ( Capabilities.haveSwing() ) { bsh.util.Util.startSplashScreen(); try (Interpreter interpreter = new Interpreter()) { interpreter.eval("desktop()"); } catch ( IOException | EvalError e ) { System.err.println("Couldn't start desktop: "+e); } } else { System.err.println( "Can't find javax.swing package: " +" An AWT based Console is available but not built by default."); //AWTConsole.main( args ); } } }
/** Create a new instance of the class manager. Class manager instnaces are now associated with the interpreter. @see bsh.Interpreter.getClassManager() @see bsh.Interpreter.setClassLoader( ClassLoader ) */ public static BshClassManager createClassManager( Interpreter interpreter ) { BshClassManager manager; // Do we have the optional package? if ( Capabilities.classExists("bsh.classpath.ClassManagerImpl") ) try { // Try to load the module // don't refer to it directly here or we're dependent upon it Class clazz = Class.forName( "bsh.classpath.ClassManagerImpl" ); manager = (BshClassManager) clazz.newInstance(); } catch ( Exception e ) { throw new InterpreterError("Error loading classmanager", e); } else manager = new BshClassManager(); if ( interpreter == null ) interpreter = new Interpreter(); manager.declaringInterpreter = interpreter; classManagers.put(manager,null); return manager; }
/** Create a new instance of the class manager. Class manager instnaces are now associated with the interpreter. @see bsh.Interpreter.getClassManager() @see bsh.Interpreter.setClassLoader( ClassLoader ) */ public static BshClassManager createClassManager( Interpreter interpreter ) { BshClassManager manager; // Do we have the optional package? if ( Capabilities.classExists("bsh.classpath.ClassManagerImpl") ) try { // Try to load the module // don't refer to it directly here or we're dependent upon it Class<?> clazz = Capabilities.getExisting("bsh.classpath.ClassManagerImpl"); manager = (BshClassManager) clazz.getConstructor().newInstance(); } catch ( IllegalArgumentException | ReflectiveOperationException | SecurityException e) { throw new InterpreterError("Error loading classmanager", e); } else manager = new BshClassManager(); manager.declaringInterpreter = interpreter; return manager; }