Article View: borland.public.jbuilder.java.api
Article #814Re: Mixing java with non-java..?
From: Shankar Unni
Date: Mon, 11 Nov 2002 18:01
Date: Mon, 11 Nov 2002 18:01
33 lines
2450 bytes
2450 bytes
BH wrote: > We're new to java and wondering about the prospects of easing it into > our current non-java apps until they are eventually 100% java.... > > Is it possible to "blend" java desktop or C/S app widgets (not > web/browser stuff) with a win32 app such that the java portions appear > to be part of the calling win32 app or dll? Not without some difficulty, but it's not impossible. The problem is that the Java stuff needs a JRE to run, so for starters, you'll have to bundle a JRE. The normal code sequence to load and run Java code from C/C++ code is to use "JNI" (the Java Native Interface) to create a virtual machine, and feed it code to execute. However, in your case, where you have a C/C++ DLL that you want to ship, and have various entry points in it (which can be called in any sequence or selection) turn around and call Java code, you probably want to create some sort of "helper class" that'll load the VM once (on first invocation), and then invoke the Java code underneath. In order to make this easier to encapsulate, your Java code should probably implement some standard interface, so that the boilerplate code to invoke it and pass parameters can be shared by the various library entry points.. So the short answer is again: yes, it can be done, but it might be painful and messy. -- Shankar.
Technical Details
Message-ID:
<3dcff06b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3dcbe4ef$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,add35f16ae99f9ac X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-11-11 10:18:04 PST Date: Mon, 11 Nov 2002 10:01:16 -0800 From: Shankar Unni <shankar@cotagesoft.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api Subject: Re: Mixing java with non-java..? References: <3dcbe4ef$1@newsgroups.borland.com> In-Reply-To: <3dcbe4ef$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 64.165.207.59 Message-ID: <3dcff06b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1037037675 64.165.207.59 (11 Nov 2002 10:01:15 -0800) Lines: 35 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail