Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - Calling C/C++ code from Java?

 
Thread Tools Search this Thread
Old 03-29-2005, 06:20 AM   #1
Default Calling C/C++ code from Java?


What is the procedure used to call C/C++ code in library from Java?

TIA,

-Ramon F Herrera



Ramon F Herrera
  Reply With Quote
Old 03-29-2005, 06:23 AM   #2
Chris Smith
 
Posts: n/a
Default Re: Calling C/C++ code from Java?
Ramon F Herrera <> wrote:
> What is the procedure used to call C/C++ code in library from Java?


Google "JNI"

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation


Chris Smith
  Reply With Quote
Old 03-29-2005, 08:16 AM   #3
Kevin McMurtrie
 
Posts: n/a
Default Re: Calling C/C++ code from Java?
In article < .com>,
"Ramon F Herrera" <> wrote:

> What is the procedure used to call C/C++ code in library from Java?
>
> TIA,
>
> -Ramon F Herrera


http://java.sun.com/docs/books/tutor...ve1.1/TOC.html

It sucks at first because you'll be facing an overwhelming number of
bugs in your code. After a while you get the hang of it and it's pretty
easy.

Run a leak check utility when you're using JNI. You'll leak memory if
you don't handle Java strings and arrays properly.


Kevin McMurtrie
  Reply With Quote
Old 03-29-2005, 09:41 AM   #4
Richard Chrenko
 
Posts: n/a
Default Re: Calling C/C++ code from Java?
On Mon, 28 Mar 2005 23:16:59 -0800, Kevin McMurtrie
<> wrote:

> In article < .com>,
> "Ramon F Herrera" <> wrote:
>
>> What is the procedure used to call C/C++ code in library from Java?
>>
>> TIA,
>>
>> -Ramon F Herrera

>
> http://java.sun.com/docs/books/tutor...ve1.1/TOC.html
>
> It sucks at first because you'll be facing an overwhelming number of
> bugs in your code. After a while you get the hang of it and it's pretty
> easy.
>
> Run a leak check utility when you're using JNI. You'll leak memory if
> you don't handle Java strings and arrays properly.



What would leak memory (which process?), and which type of utility would
you recommend to detect this?


Richard Chrenko
  Reply With Quote
Old 03-29-2005, 02:16 PM   #5
Manuel J. Goyenechea
 
Posts: n/a
Default Re: Calling C/C++ code from Java?
You may want to take at Jenie, www.servertec.com/products/jenie/jenie.html

Jenie is a collection of Java Classes and supporting native libraries that
allows developers to directly access native libraries without having to use
Java Native Interface (JNI) and without having to write C/C++ code.

"Ramon F Herrera" <> wrote in message
news: oups.com...
> What is the procedure used to call C/C++ code in library from Java?
>
> TIA,
>
> -Ramon F Herrera
>





Manuel J. Goyenechea
  Reply With Quote
Old 03-30-2005, 07:01 AM   #6
Kevin McMurtrie
 
Posts: n/a
Default Re: Calling C/C++ code from Java?
In article <>,
"Richard Chrenko" <> wrote:

> On Mon, 28 Mar 2005 23:16:59 -0800, Kevin McMurtrie
> <> wrote:
>
> > In article < .com>,
> > "Ramon F Herrera" <> wrote:
> >
> >> What is the procedure used to call C/C++ code in library from Java?
> >>
> >> TIA,
> >>
> >> -Ramon F Herrera

> >
> > http://java.sun.com/docs/books/tutor...ve1.1/TOC.html
> >
> > It sucks at first because you'll be facing an overwhelming number of
> > bugs in your code. After a while you get the hang of it and it's pretty
> > easy.
> >
> > Run a leak check utility when you're using JNI. You'll leak memory if
> > you don't handle Java strings and arrays properly.

>
>
> What would leak memory (which process?), and which type of utility would
> you recommend to detect this?


Which process? It's all one with JNI. It's possible to leak in the
process heap and the Java heap.

I've been using 'leaks' that comes with OS X. It scans for memory
allocations that don't appear to have any pointer to them. It's a
little slow and imperfect but it points out big leaks as bright as day.
When the environment variable "MallocStackLogging" is set, all
allocations are tagged with a stack trace that shows up in the output of
'leaks' and other debugging tools. It's very cool.


Kevin McMurtrie
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java code to send MS Outlook Tasks mansi Software 0 03-03-2009 09:20 AM
Java Error: java.lang.ClassFormatError: oracle/jdbc/ttc7/TTC7Protocol Shalz Software 0 03-08-2008 06:05 PM
Java Beginners Still Bill Software 3 02-19-2008 10:13 AM
How To Access HTML elements in code behind??? nedums_b Software 1 02-07-2008 07:15 PM
Calling Java methods in C boyabhi123 Software 0 08-02-2007 10:42 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46