File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login


JavaRanch » Java Forums » Java » Performance
Reply 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: 25

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: 16487
    
    2

Not a portlets question. Moving.
prabal nandi
Greenhorn

Joined: Jun 28, 2011
Posts: 25

JavaRanch » Java Forums » Java » Performance
prabal nandi
Greenhorn

Joined: Jun 28, 2011
Posts: 25

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: 12325
    
    1
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

Java Resources at www.wbrogden.com
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

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: 376

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Calling C or C++ methods from Java
 
Similar Threads
this(Color.Red) ?
need of obfuscation code with web application and how to do it
RMI+JNI or CORBA?
Visual C++ required???
From Valiveru's mock exam