🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #3555

Invoking the JVM on a specified class

#3555
From: Peter Thompson
Date: Thu, 04 Dec 1997 00:00
37 lines
1817 bytes
Hi there,

Maybe I am overlooking something blindingly simple here, but this
problem has really stumped me.
I am writing a Java IDE in Java.  I have worked out how to compile a
source file from within the program but I cannot for the life of me work
out how to run the application once it has been compiled.

With the compiler, you just create an instance of the class
sun.tools.javac.Main and call the compile() function with the source
file as an argument.  There does not seem to be a similar way of doing
this with the <java> command line tool.  My application is trying to be
PURE java so does not want to be tied to creating a new Process and
exec()'ing a platform specific command which invokes the JVM.

Is it possible for a Java program to invoke another java program in the
same way in which the command line works.

Something is telling me that I have overlooked a very simple solution.

One possible idea that I have had is that I have to check for an
instance of the
static void main(String ars[]) function, if this is present then the
class file must be runnable.  I could then construct an instance of the
class and somehow call the main() function.  Is this right??

I am very pushed for time in getting this implemented, so I would be
extremely happy if someone could share their experiences of anything
similar.

Thanks in advance for any help,

Regards,


Chris Pilsworth
Technical Details
Message-ID: <3486A7B5.28910287@homeaway.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,b591a1d536192c2e,start
X-Google-Attributes: gid1089d0,public
From: Peter Thompson <peter@homeaway.demon.co.uk>
Subject: Invoking the JVM on a specified class
Date: 1997/12/04
Message-ID: <3486A7B5.28910287@homeaway.demon.co.uk>
X-Deja-AN: 295113369
Organization: None
Newsgroups: borland.public.jbuilder.java.api