Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Creating a VM instance programatically
Creating a VM instance programatically [message #143197] Wed, 18 February 2004 23:32 Go to next message
Eclipse UserFriend
Originally posted by: handcock.redhat.com

Does anyone know how to create an installed VM definition programatically?
ie. I 'm trying to add a JVM at /foo/bar/java_home to the Eclipse
preferences using Eclipse API calls.

Thanks,

Jeremy
Re: Creating a VM instance programatically [message #143325 is a reply to message #143197] Thu, 19 February 2004 14:12 Go to previous messageGo to next message
Darin Wright is currently offline Darin WrightFriend
Messages: 454
Registered: July 2009
Senior Member
Create an instance of a VMStandin, set its properties/attributes, and then
call "convertToRealVM". This will add it to the JRE definitions.

Darin

"Jeremy Handcock" <handcock@redhat.com> wrote in message
news:c10smj$5km$1@eclipse.org...
> Does anyone know how to create an installed VM definition programatically?
> ie. I 'm trying to add a JVM at /foo/bar/java_home to the Eclipse
> preferences using Eclipse API calls.
>
> Thanks,
>
> Jeremy
>
Re: Creating a VM instance programatically [message #144065 is a reply to message #143325] Fri, 20 February 2004 17:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: handcock.redhat.com

Darin Wright wrote:

> Create an instance of a VMStandin, set its properties/attributes, and then
> call "convertToRealVM". This will add it to the JRE definitions.

Thanks, Darin.

I'm somewhat of an eclipse newbie. This snippet doesn't seem to be
working for me:

StandardVMType stdvmtype = new StandardVMType();
VMStandin standin = new VMStandin(stdvmtype, "someUniqueID");
standin.setInstallLocation(new File("/opt/IBMJava2-141"));
standin.setName("IBMJava2-141");
IVMInstall realVM = standin.convertToRealVM();
try {
JavaRuntime.setDefaultVMInstall(realVM, null, true);
} catch(Exception e) {
e.printStackTrace();
}

Whenever I try to setDefaultVMInstall, I get a NPE at
org.eclipse.jdt.internal.launching.CompositeId.toString(Comp ositeId.java:42).

Are there additional things that I need to define in the VMStandin before
calling convertToRealVM()?

Thanks.

Jeremy

> "Jeremy Handcock" <handcock@redhat.com> wrote in message
> news:c10smj$5km$1@eclipse.org...
> > Does anyone know how to create an installed VM definition programatically?
> > ie. I 'm trying to add a JVM at /foo/bar/java_home to the Eclipse
> > preferences using Eclipse API calls.
> >
> > Thanks,
> >
> > Jeremy
> >
Re: Creating a VM instance programatically [message #144643 is a reply to message #144065] Mon, 23 February 2004 14:29 Go to previous messageGo to next message
Darin Wright is currently offline Darin WrightFriend
Messages: 454
Registered: July 2009
Senior Member
You should not create an instance of "StandardVMType", you should retrieve
it from the launching plug-in

JavaRuntime.getVMInstallType(String id).

The id for a standard VM type is
"org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType".

Darin

"Jeremy Handcock" <handcock@redhat.com> wrote in message
news:c15eu6$c93$1@eclipse.org...
> Darin Wright wrote:
>
> > Create an instance of a VMStandin, set its properties/attributes, and
then
> > call "convertToRealVM". This will add it to the JRE definitions.
>
> Thanks, Darin.
>
> I'm somewhat of an eclipse newbie. This snippet doesn't seem to be
> working for me:
>
> StandardVMType stdvmtype = new StandardVMType();
> VMStandin standin = new VMStandin(stdvmtype, "someUniqueID");
> standin.setInstallLocation(new File("/opt/IBMJava2-141"));
> standin.setName("IBMJava2-141");
> IVMInstall realVM = standin.convertToRealVM();
> try {
> JavaRuntime.setDefaultVMInstall(realVM, null, true);
> } catch(Exception e) {
> e.printStackTrace();
> }
>
> Whenever I try to setDefaultVMInstall, I get a NPE at
>
org.eclipse.jdt.internal.launching.CompositeId.toString(Comp ositeId.java:42)
..
>
> Are there additional things that I need to define in the VMStandin before
> calling convertToRealVM()?
>
> Thanks.
>
> Jeremy
>
> > "Jeremy Handcock" <handcock@redhat.com> wrote in message
> > news:c10smj$5km$1@eclipse.org...
> > > Does anyone know how to create an installed VM definition
programatically?
> > > ie. I 'm trying to add a JVM at /foo/bar/java_home to the Eclipse
> > > preferences using Eclipse API calls.
> > >
> > > Thanks,
> > >
> > > Jeremy
> > >
>
>
Re: Creating a VM instance programatically [message #144688 is a reply to message #144643] Mon, 23 February 2004 15:42 Go to previous message
Eclipse UserFriend
Originally posted by: handcock.redhat.com

Ah, I see. Excellent... got this to work now. Thanks for your help, Darin.

Jeremy

On 02/23/2004 09:29 AM, Darin Wright wrote:
> You should not create an instance of "StandardVMType", you should retrieve
> it from the launching plug-in
>
> JavaRuntime.getVMInstallType(String id).
>
> The id for a standard VM type is
> "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType".
>
> Darin
>
> "Jeremy Handcock" <handcock@redhat.com> wrote in message
> news:c15eu6$c93$1@eclipse.org...
>
>>Darin Wright wrote:
>>
>>
>>>Create an instance of a VMStandin, set its properties/attributes, and
>
> then
>
>>>call "convertToRealVM". This will add it to the JRE definitions.
>>
>>Thanks, Darin.
>>
>>I'm somewhat of an eclipse newbie. This snippet doesn't seem to be
>>working for me:
>>
>>StandardVMType stdvmtype = new StandardVMType();
>>VMStandin standin = new VMStandin(stdvmtype, "someUniqueID");
>>standin.setInstallLocation(new File("/opt/IBMJava2-141"));
>>standin.setName("IBMJava2-141");
>>IVMInstall realVM = standin.convertToRealVM();
>>try {
>>JavaRuntime.setDefaultVMInstall(realVM, null, true);
>>} catch(Exception e) {
>> e.printStackTrace();
>>}
>>
>>Whenever I try to setDefaultVMInstall, I get a NPE at
>>
>
> org.eclipse.jdt.internal.launching.CompositeId.toString(Comp ositeId.java:42)
> .
>
>>Are there additional things that I need to define in the VMStandin before
>>calling convertToRealVM()?
>>
>>Thanks.
>>
>>Jeremy
>>
>>
>>>"Jeremy Handcock" <handcock@redhat.com> wrote in message
>>>news:c10smj$5km$1@eclipse.org...
>>>
>>>>Does anyone know how to create an installed VM definition
>
> programatically?
>
>>>> ie. I 'm trying to add a JVM at /foo/bar/java_home to the Eclipse
>>>>preferences using Eclipse API calls.
>>>>
>>>>Thanks,
>>>>
>>>>Jeremy
>>>>
>>
>>
>
>
Previous Topic:Console Terminate and addShutdownHook(Thread)
Next Topic:Setting tab behavior for all editors
Goto Forum:
  


Current Time: Tue Nov 12 19:42:45 GMT 2024

Powered by FUDForum. Page generated in 0.03719 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top