cpp: "Send.c", line 2: error 4036: Can't open include file 'jni.h'.
843829Jul 28 2005 — edited Jul 28 2005ram@aqua: /home/ed852603/Ram [147] >cc Send.c
cpp: "Send.c", line 2: error 4036: Can't open include file 'jni.h'.
after compiling the following java file..
i am trying to access the send method in Send.c file..
i am getting the above mentioned error..pls help me in fixing this problem..
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SendApp {
public void send()
{
String subject = "HI";
String content = "hi how are you this is ram";
String from = "ramkumar.maddela@exaphub.exch.eds.com";
String to = "srinivasan.sathyanarayanan@exaphub.exch.eds.com";
try{
// Create a mail session
java.util.Properties props = new java.util.Properties();
props.put("mail.smtp.host", "intpm202.apac.corp.eds.com");
// props.put("mail.smtp.host", smtpHost);
// props.put("mail.smtp.port", ""+smtpPort);
Session session = Session.getDefaultInstance(props, null);
// Construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);
// Send the message
Transport.send(msg);
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
#include <stdio.h>
#include <jni.h>
void main(int argc, char *argv[])
{
JavaVM *jvm;
JNIEnv *env;
JDK1_1InitArgs vm_args;
int verbose = 1;
printf("Hello, world\n");
jclass cls;
jmethodID mid;
jthrowable jthr;
/* Setup the environment */
JNI_GetDefaultJavaVMInitArgs ( &vm_args );
vm_args.classpath = "/home/ed852603/Ram:.";
JNI_CreateJavaVM(&jvm, &env, &vm_args );
/* Find the class we want to load */
cls = (*env)->FindClass( env, "SendApp" );
if ( verbose ) printf ( "Class: %x" , cls );
/* Find the method we want to use */
mid = (*env)->GetMethodID( env, cls, "send", "(I)I" );
if ( verbose ) printf ( "Method: %x" , mid );
printf("second call to Java returns:%d\n", (*env)->CallVoidMethod(env, cls, mid) );
}