🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Invoking the JVM on a specified class

#3560
From: Rich Wilkman
Date: Thu, 04 Dec 1997 00:00
46 lines
2127 bytes
Peter:

Runtime.exec() may work.  You may need to have slightly different
command strings between Win95 and NT (and definitly different for *nix),
but that's where I'd start.

-Rich

Peter Thompson wrote:
> 
> 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: <3486F3B7.1BD70CE@corp.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3486A7B5.28910287@homeaway.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,b591a1d536192c2e
X-Google-Attributes: gid1089d0,public
From: Rich Wilkman <rwilkman@corp.borland.com>
Subject: Re: Invoking the JVM on a specified class
Date: 1997/12/04
Message-ID: <3486F3B7.1BD70CE@corp.borland.com>
X-Deja-AN: 295209018
References: <3486A7B5.28910287@homeaway.demon.co.uk>
Newsgroups: borland.public.jbuilder.java.api