This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: how to start kawa inside a running java application
Thanks Jim,
I actually needed to start repl on a socket from inside a running java
app and connect to it via telnet, I ended up with something like the
code below...
For some reason I had to add lines (1) and (2). Before I added them,
line (3) was returning null....
static void startKawaRepl(final int port) throws IOException {
Language previousLanguage = Language.getInstance(null); // (1)
Language.setDefaults(previousLanguage); // (2)
Runnable r = new Runnable() {
final ServerSocket ss = new ServerSocket(port);
public void run() {
try {
while(true) {
TelnetRepl.serve(Scheme.getInstance("scheme"), ss.accept()); // (3)
System.err.println("accepted");
}
} catch (IOException ioe) {
// nothing
}
}
};
Thread t = new Thread(r);
t.setDaemon(true);
t.start();
}
Boris
On 7/12/07, Jim White <jim@pagesmiths.com> wrote:
Boris Mizhen - wrote:
> Hello all,
>
> I wonder how to start kawa inside a running java application and get
> access to repl?
There are a lot of ways to do that. If you're just looking for a
different way to start the repl, looking at kawa.sh will show you that
the command line start up main-class is kawa.repl. So
'kawa.repl.main(new String[0])' will get you a prompt on System.in/out.
Jim