• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

JSP calling native code using JNI

Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I want to create a JSP page and then call a native method from the page using JNI. I have been able to call a native method form a simple java program but having problem including the code in a JSP page.

The java program code that works is as follows:

class Native1 {
public native String getValue(String sMain, String sKey, String sFile);
static {

public static void main(String[] args) {

String xxx;
xxx = new Native1().getValue("Main", "gautam", "C:\\test.ini");

test.ini file contains only two entries
gautam= Gautam

The value being printed on the console as the output is Gautam(the logic for reading the ini file and getting the value is being defined in the C++ file)

Please let me know how the above java code can be used in a JSP page. Your help would be sincerely appreciated.

[ June 20, 2004: Message edited by: Bear Bibeault ]
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic