Creating a VM instance programatically [message #143197] |
Wed, 18 February 2004 23:32 |
Eclipse User |
|
|
|
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 #144065 is a reply to message #143325] |
Fri, 20 February 2004 17:08 |
Eclipse User |
|
|
|
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 |
Darin Wright 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 |
Eclipse User |
|
|
|
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
>>>>
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03719 seconds