Discussion in 'Java' started by Paul Selibas, Nov 24, 2005.

  1. Paul Selibas

    Paul Selibas Guest

    Good day everyone...

    I have a question and any bit of advice would be appreciated.

    What would be the easiest possible way to implement a scripting system
    in a java program so that you can have a core + modules kind of system.
    Or even perhaps compile Java code at runtime. Is this even possible?

    What i want to do it make a core and other people can program modules
    that will just fit in without changing the core program.

    Many thanks to those who contribute.

    Paul Selibas
    Paul Selibas, Nov 24, 2005
    1. Advertisements

  2. NullBock

    NullBock Guest

    You've lot's of different ways of implementing this. And you don't
    have to require run-time compilation either, merely realease a public
    API that the module creators can use. We do this fairly extensively
    with our products, releasing a fairly large API that users can click

    If you do want to go run-time, there are a few things you could
    consider. For instance, the Mozilla orginazation has a great pure-Java
    JavaScript engine called Rhino (very stable, been around along
    time)--go to There are engines for almost
    every language around, including Java. JavaWorld ran a comparison of
    different engines a couple years back :

    Walter Gildersleeve
    Freiburg, Germany

    URL Shortening
    Free and easy, small and green
    NullBock, Nov 24, 2005
    1. Advertisements

  3. Guest

    Take a look at Beanshell. It is a lightweight scripting language that
    is very close to Java. This closeness makes it work very well with
    standard Java objects.

    If you want to build such an extendable model, it might also be worth
    to take a look at the OSGi specifications. They form the foundation of
    the Eclipse IDE. The OSGi specifies a small framework that manages the
    modularity and lifecycle issues of a plugin based model.

    Kind regards,

    Peter Kriens
    , Nov 25, 2005
  4. Guest

    you can also read at runtime a .properties file that contains a comma
    separated list of fully qualified class
    Instanciate using reflexion thoses classes (assuming they are in the
    classpath), cast them as com.yourpackage.YourPluginInterface, and use
    this list in your core program.

    To get thoses classes in the classpath at runtime, set a directory for
    "plugins", and instanciate an URLClassLoader, that "loads" all jars in.

    Its very very basic and simple yet performant as far as your
    application is not build upon thousands of different plugins type.
    , Nov 25, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
  2. Richard Maher
    Richard Maher
    Jul 2, 2007
  3. bugbear
  4. =?iso-8859-1?q?Robin_K=E5veland?=

    Plugins / Modularity

    =?iso-8859-1?q?Robin_K=E5veland?=, Oct 10, 2007, in forum: Python
  5. naorye
    Nov 30, 2009

Share This Page