Click here to Skip to main content
15,884,237 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Solution ot the following error Pin
David Crow21-Sep-07 3:01
David Crow21-Sep-07 3:01 
Questionhow to get port number Pin
p_20-Sep-07 23:37
p_20-Sep-07 23:37 
AnswerRe: how to get port number Pin
kakan21-Sep-07 0:42
professionalkakan21-Sep-07 0:42 
AnswerRe: how to get port number Pin
p_21-Sep-07 1:14
p_21-Sep-07 1:14 
GeneralRe: how to get port number Pin
David Crow21-Sep-07 2:57
David Crow21-Sep-07 2:57 
GeneralRe: how to get port number Pin
Dave Kreskowiak21-Sep-07 12:42
mveDave Kreskowiak21-Sep-07 12:42 
QuestionCOM port problems Pin
Cedric Moonen20-Sep-07 22:59
Cedric Moonen20-Sep-07 22:59 
QuestionCalling java method from c++ ! stuck in between while invoking jvm! Pin
amitamit19820-Sep-07 22:50
amitamit19820-Sep-07 22:50 
//Its tt.java simple Helloworld program .which i am willing to call from c++
// i created .class and .h file of it !

public class tt {
public static void main(String[] args) {
System.out.println("Hello World ");
}
}

//*****************************************************************************************


//i wrote it in vc++ 6.0
//for this i added path of tt.h(created using javah) in preprocessor path(underprojects=>setting=>c/c++ tab)
//then added path of jvm.lib (under projects=>setting=>link tab)


#include "jni.h"
#define PATH_SEPARATOR ';' /* define it to be ':' on Solaris */
#define USER_CLASSPATH "C:\j2sdk1.4.2_05\bin" /* where tt.class is */

int main()
{
JNIEnv *env;
JavaVM *jvm;
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jclass stringClass;
jobjectArray args;;
JavaVMInitArgs vm_args;;
JavaVMOption options[1];
options[0].optionString ="-Djava.class.path="USER_CLASSPATH;
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);


if (res < 0) {
fprintf(stderr, "Can't create Java VM\n");
// exit(1);
}
cls = (env)->FindClass("tt");
if (cls == 0) {
// goto destroy;
}

mid = (env)->GetStaticMethodID(cls, "main","([Ljava/lang/String;)V");
if (mid == 0) {
// goto destroy;
}
jstr = (env)->NewStringUTF(" from C!");
if (jstr == 0) {
// goto destroy;
}
stringClass = (env)->FindClass("java/lang/String");
args = (env)->NewObjectArray(1, stringClass, jstr);
if (args == 0) {
// goto destroy;
}
(env)->CallStaticVoidMethod(cls, mid, args);

//destroy:
if ((env)->ExceptionOccurred()) {
(env)->ExceptionDescribe();
}
(jvm)->DestroyJavaVM();
return 0;
}


/// After doing that much ! i got this LINKING TIME ERRORs

--------------------Configuration: ltry - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
tr.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/ltry.exe : fatal error LNK1120: 1 unresolved externals

// please help me sir....what chages i should do so that it gets run n calls java method ?
AnswerRe: Calling java method from c++ ! stuck in between while invoking jvm! Pin
Cedric Moonen20-Sep-07 23:23
Cedric Moonen20-Sep-07 23:23 
AnswerRe: Calling java method from c++ ! stuck in between while invoking jvm! Pin
David Crow21-Sep-07 2:55
David Crow21-Sep-07 2:55 
QuestionHow to write in windows registry Pin
Exelioindia20-Sep-07 21:00
Exelioindia20-Sep-07 21:00 
AnswerRe: How to write in windows registry Pin
Llasus20-Sep-07 21:12
Llasus20-Sep-07 21:12 
GeneralRe: How to write in windows registry Pin
Exelioindia20-Sep-07 21:50
Exelioindia20-Sep-07 21:50 
GeneralRe: How to write in windows registry Pin
Llasus20-Sep-07 22:02
Llasus20-Sep-07 22:02 
GeneralRe: How to write in windows registry Pin
Exelioindia21-Sep-07 0:09
Exelioindia21-Sep-07 0:09 
QuestionRe: How to write in windows registry Pin
David Crow21-Sep-07 2:51
David Crow21-Sep-07 2:51 
AnswerRe: How to write in windows registry Pin
nbugalia20-Sep-07 21:28
nbugalia20-Sep-07 21:28 
GeneralRe: How to write in windows registry Pin
Exelioindia20-Sep-07 21:50
Exelioindia20-Sep-07 21:50 
AnswerRe: How to write in windows registry Pin
Hamid_RT20-Sep-07 21:57
Hamid_RT20-Sep-07 21:57 
AnswerRe: How to write in windows registry Pin
ThatsAlok20-Sep-07 23:08
ThatsAlok20-Sep-07 23:08 
AnswerRe: How to write in windows registry Pin
Rahul Vaishnav21-Sep-07 1:03
Rahul Vaishnav21-Sep-07 1:03 
GeneralRe: How to write in windows registry Pin
Exelioindia21-Sep-07 1:33
Exelioindia21-Sep-07 1:33 
GeneralRe: How to write in windows registry Pin
David Crow21-Sep-07 2:49
David Crow21-Sep-07 2:49 
General[Message Deleted] Pin
Californian221-Sep-07 5:57
Californian221-Sep-07 5:57 
GeneralRe: How to write in windows registry Pin
David Crow21-Sep-07 6:07
David Crow21-Sep-07 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.