Use non-standard VM as JRE - and then debug [message #258641] |
Thu, 12 February 2009 02:09  |
Eclipse User |
|
|
|
Hi all,
My first post to this group.
I have a small VM / class lib (custom - not Sun/IBM etc) that I want to
register as a JRE in eclipse. My goal is to get eclipse to use the VM
when launching for debug. The VM has a JDWP interface and so I can
already start it outside of eclipse, attach to it and debug very
sucessfully. I want to use it in a more 'eclipsey' fashion.
Execution environments seem to rely on a JRE being established (I think),
so getting the small VM into eclipse as a JRE seems to be the first step.
But, I think eclipse wants to find explicit 'things' in a JRE I suspect -
along in a standard directory structure (I donlt know what those 'things'
are)
How do I get this VM registered in eclipse so I can use it as the launch
VM for debugging? It does not have the same executables/jars/directories
as a Sun JRE.
Many thanks, and all help appreciated.
Greg.
|
|
|
Re: Use non-standard VM as JRE - and then debug [message #259097 is a reply to message #258641] |
Tue, 17 March 2009 00:09  |
Eclipse User |
|
|
|
No reply from the forum, but I have figured it out, so I'll put it here
for posterity.
Goal : To integrate a new small non-Sun/IBM VM into eclipse and use
eclipse debug/launch just like a "real" VM. The target VM, like many
small VMs does not have everything implemented just like the big VMs. So
in that sense it is not a "standard" VM.
1) To create a new JRE in eclipse you need to be able to point to a
directory that eclipse thinks is a "Standard VM" directory. Eclipse needs
two things to be in this VM directory structure. a) an executable in a
"bin" directory called any of the following : "javaw", "javaw.exe",
"java", "java.exe", "j9w", "j9w.exe", "j9", "j9.exe". And b) and an
rt.jar file in a "lib" directory.
With just two files, you can create a new "Standard VM" JRE in eclipse
that is not a standard VM.
2) When eclipse launches your VM executable for debugging or running it
passes a number of command line options to it. Of course, it uses well
known (although "non-standard") command line options.
When eclipse attempts to launch a VM for debugging, the VM must be able to
respect a command line that looks like this:
-Xdebug -Xnoagent -Djava.compiler=NONE -Dfile.encoding=Cp1252
-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:<port >
-classpath <classpath> <program>
where <port> is the port that eclipse has opened for the VM to attach to,
<classpath> is the project classpath that is part of the eclipse project, and
<program> is your java program to debug.
My VM ignores most of the -X stuff except for the -X debugger stuff.
Additionally, eclipse may send a -Xbootclasspath: command line option as
well.
The eclipse JDWP usage seems pretty standard, but it wanted some specific
things, like some thread groups with specific names. My VM does not
support threadgroups so I dummied some up in the JDWP command responses to
make it look like there were some - eclipse was happy. I used JDWPAnalyzer
to check it out.
I now have a small non-"Standard VM" perfectly integrated into eclipse and
it seems to be none the wiser about it non-standardness.
Life is sweeeeeeeeet.
Happy to supply more info if required. Catch me at :
g m c c r e a t h @@ h o t m a i l . c o m.
(spaces and double @@ to stop spam).
|
|
|
Powered by
FUDForum. Page generated in 0.03609 seconds