aspose file tools*
The moose likes Performance and the fly likes Calling C or C++ methods from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Calling C or C++ methods from Java " Watch "Calling C or C++ methods from Java " New topic
Author

Calling C or C++ methods from Java

prabal nandi
Greenhorn

Joined: Jun 28, 2011
Posts: 28

if i make a java application running on a server, which is calling C or C++ methods having all the busniess logic, will that make my application faster compared to a normal java application.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

Not a portlets question. Moving.
prabal nandi
Greenhorn

Joined: Jun 28, 2011
Posts: 28

JavaRanch » Java Forums » Java » Performance
prabal nandi
Greenhorn

Joined: Jun 28, 2011
Posts: 28

Sorry i guess this post got posted twice.. "JavaRanch » Java Forums » Java » Performance ". this will be the correct path.
but can somebody seriously help me out and can also provide a proper explaination.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Creating and calling the interface to JNI methods certainly will consume some CPU time so your C or C++ would have to be faster to justify that.

If multiple clients can access the application, you would have to manage the separate requests. If database access is involved in the business logic that CPU time would probably be much more important than execution of logic code so the language won't matter.

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

That might make your code faster. But it would have to make it a whole lot faster before it was worth doing, if you're talking about a server application.
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 417
    
    2

There are lots of good reasons to call c++ from java and business logic isn't one of them generally.

JNI has an over head and unoptimised C++ can run slower than Java, Javas is not that slow any more check out some benchmarks on the web before proceeding.


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling C or C++ methods from Java