This discussion is archived
2 Replies Latest reply: Oct 14, 2011 12:02 PM by EJP RSS

JLabel constructor call problem

893718 Newbie
Currently Being Moderated

I've problem with calling JLabel's constructor with passing String value to constructor.
jobject jobjLabel;
jclass JLabelClass;
jmethodID mid;
JLabelClass = (*env)->FindClass(env,"javax/swing/JLabel");
  if(JLabelClass == NULL) {
     printf("Can't find class JLabel\n");
     goto destroy;

  mid = (*env)->GetMethodID(env,JLabelClass,"<init>","(Ljava/lang/String;)V");
  jobjLabel = (*env)->NewObject(env,JLabelClass,mid,"Hello World");
At line:
 jobjLabel = (*env)->NewObject(env,JLabelClass,mid,"Hello World");
Main Thread exits with error code 1. I am sure that this line is true but I didn't find problem.

Are there any methods to find errors before program exit?


  • Correct Answers - 10 points
  • Helpful Answers - 5 points