Re: JNI Native - System (java.lang.System)

2018-08-03 Thread mr rupplin
Yeah OK.  SETEC ASTRONOMY.

From: David Holmes 
Sent: Friday, August 3, 2018 9:03 AM
To: mr rupplin; build-dev@openjdk.java.net
Subject: Re: JNI Native - System (java.lang.System)

On 3/08/2018 10:49 PM, mr rupplin wrote:
> How would I subscribe to core-libs-dev?

The same way you subscribed to build-dev. ???

http://mail.openjdk.java.net/mailman/listinfo/core-libs-dev

David

> Ok.
> 
> *From:* David Holmes 
> *Sent:* Thursday, August 2, 2018 11:55 PM
> *To:* mr rupplin; build-dev@openjdk.java.net
> *Subject:* Re: JNI Native - System (java.lang.System)
> Hi Max,
>
> The build-dev list is for discussing the OpenJDK build system. You
> appear to running into issues customizing parts of OpenJDK for your own
> use. It would be more appropriate to ask on core-libs-dev how to extend
> the System class - though examination of the existing native methods in
> System.java and System.c should show how it is done. There is not enough
> information in your post to see where you may have a made an error or
> omission.
>
> Cheers,
> David
>
> On 3/08/2018 12:53 PM, mr rupplin wrote:
>> Hello.
>>
>> Trying to run a simple JNI call and I keep getting the following:
>>
>> SecureJVM : GNU Public License 2.0
>> Program Name >> java
>> Launcher Name >> openjdk
>> Windows >> off
>> Version >> 9-internal+0-adhoc.mearvk.jdk9
>>
>> A new instance of Hope is born.
>> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
>> java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
>> at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
>> at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
>> at Hope.(Hope.java:19)
>>
>>
>> The source looks like:
>>
>>  public static void setMemoryAllocationListener(MemoryAllocationListener 
>> memoryAllocationListener) {
>>  checkMalloc();
>>  setMemoryAllocationListener0(memoryAllocationListener);
>>  }
>>
>>
>> The C source looks like:
>>
>>
>> JNIEXPORT void JNICALL
>> Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
>> jobject listener)
>> {
>> printf("setMemoryAllocationListener called:\n");
>>
>>  jfieldID fid =
>>  
>> (*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");
>>
>>  printf("\t >> Lookup of MemoryAllocationListener completed");
>>
>>  if (fid == 0)
>>  return;
>>
>>
>>  (*env)->SetStaticObjectField(env,cla,fid,listener);
>>
>>  printf("\t >> SetStaticObjectField completed");
>> }
>>
>>
>> I am unable to discern the problem.  The make runs clean as does a 
>> non-native call that instantiates a MemoryAllocationListener object.
>>
>> Can you guys spot the issue?
>>
>> Thanks,
>>
>> Max R.
>>
>> Sr. Software Tech
>>


Re: JNI Native - System (java.lang.System)

2018-08-03 Thread David Holmes

On 3/08/2018 10:49 PM, mr rupplin wrote:

How would I subscribe to core-libs-dev?


The same way you subscribed to build-dev. ???

http://mail.openjdk.java.net/mailman/listinfo/core-libs-dev

David


Ok.

*From:* David Holmes 
*Sent:* Thursday, August 2, 2018 11:55 PM
*To:* mr rupplin; build-dev@openjdk.java.net
*Subject:* Re: JNI Native - System (java.lang.System)
Hi Max,

The build-dev list is for discussing the OpenJDK build system. You
appear to running into issues customizing parts of OpenJDK for your own
use. It would be more appropriate to ask on core-libs-dev how to extend
the System class - though examination of the existing native methods in
System.java and System.c should show how it is done. There is not enough
information in your post to see where you may have a made an error or
omission.

Cheers,
David

On 3/08/2018 12:53 PM, mr rupplin wrote:

Hello.

Trying to run a simple JNI call and I keep getting the following:

SecureJVM : GNU Public License 2.0
Program Name >> java
Launcher Name >> openjdk
Windows >> off
Version >> 9-internal+0-adhoc.mearvk.jdk9

A new instance of Hope is born.
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
at Hope.(Hope.java:19)


The source looks like:

  public static void setMemoryAllocationListener(MemoryAllocationListener 
memoryAllocationListener) {
  checkMalloc();
  setMemoryAllocationListener0(memoryAllocationListener);
  }


The C source looks like:


JNIEXPORT void JNICALL
Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
jobject listener)
{
printf("setMemoryAllocationListener called:\n");

  jfieldID fid =
  
(*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");

  printf("\t >> Lookup of MemoryAllocationListener completed");

  if (fid == 0)
  return;


  (*env)->SetStaticObjectField(env,cla,fid,listener);

  printf("\t >> SetStaticObjectField completed");
}


I am unable to discern the problem.  The make runs clean as does a non-native 
call that instantiates a MemoryAllocationListener object.

Can you guys spot the issue?

Thanks,

Max R.

Sr. Software Tech



Re: JNI Native - System (java.lang.System)

2018-08-03 Thread mr rupplin
How would I subscribe to core-libs-dev?

Ok.

From: David Holmes 
Sent: Thursday, August 2, 2018 11:55 PM
To: mr rupplin; build-dev@openjdk.java.net
Subject: Re: JNI Native - System (java.lang.System)

Hi Max,

The build-dev list is for discussing the OpenJDK build system. You
appear to running into issues customizing parts of OpenJDK for your own
use. It would be more appropriate to ask on core-libs-dev how to extend
the System class - though examination of the existing native methods in
System.java and System.c should show how it is done. There is not enough
information in your post to see where you may have a made an error or
omission.

Cheers,
David

On 3/08/2018 12:53 PM, mr rupplin wrote:
> Hello.
>
> Trying to run a simple JNI call and I keep getting the following:
>
> SecureJVM : GNU Public License 2.0
> Program Name >> java
> Launcher Name >> openjdk
> Windows >> off
> Version >> 9-internal+0-adhoc.mearvk.jdk9
>
> A new instance of Hope is born.
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
> at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
> at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
> at Hope.(Hope.java:19)
>
>
> The source looks like:
>
>  public static void setMemoryAllocationListener(MemoryAllocationListener 
> memoryAllocationListener) {
>  checkMalloc();
>  setMemoryAllocationListener0(memoryAllocationListener);
>  }
>
>
> The C source looks like:
>
>
> JNIEXPORT void JNICALL
> Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
> jobject listener)
> {
> printf("setMemoryAllocationListener called:\n");
>
>  jfieldID fid =
>  
> (*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");
>
>  printf("\t >> Lookup of MemoryAllocationListener completed");
>
>  if (fid == 0)
>  return;
>
>
>  (*env)->SetStaticObjectField(env,cla,fid,listener);
>
>  printf("\t >> SetStaticObjectField completed");
> }
>
>
> I am unable to discern the problem.  The make runs clean as does a non-native 
> call that instantiates a MemoryAllocationListener object.
>
> Can you guys spot the issue?
>
> Thanks,
>
> Max R.
>
> Sr. Software Tech
>


Re: JNI Native - System (java.lang.System)

2018-08-02 Thread David Holmes

Hi Max,

The build-dev list is for discussing the OpenJDK build system. You 
appear to running into issues customizing parts of OpenJDK for your own 
use. It would be more appropriate to ask on core-libs-dev how to extend 
the System class - though examination of the existing native methods in 
System.java and System.c should show how it is done. There is not enough 
information in your post to see where you may have a made an error or 
omission.


Cheers,
David

On 3/08/2018 12:53 PM, mr rupplin wrote:

Hello.

Trying to run a simple JNI call and I keep getting the following:

SecureJVM : GNU Public License 2.0
Program Name >> java
Launcher Name >> openjdk
Windows >> off
Version >> 9-internal+0-adhoc.mearvk.jdk9

A new instance of Hope is born.
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
at Hope.(Hope.java:19)


The source looks like:

 public static void setMemoryAllocationListener(MemoryAllocationListener 
memoryAllocationListener) {
 checkMalloc();
 setMemoryAllocationListener0(memoryAllocationListener);
 }


The C source looks like:


JNIEXPORT void JNICALL
Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
jobject listener)
{
printf("setMemoryAllocationListener called:\n");

 jfieldID fid =
 
(*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");

 printf("\t >> Lookup of MemoryAllocationListener completed");

 if (fid == 0)
 return;


 (*env)->SetStaticObjectField(env,cla,fid,listener);

 printf("\t >> SetStaticObjectField completed");
}


I am unable to discern the problem.  The make runs clean as does a non-native 
call that instantiates a MemoryAllocationListener object.

Can you guys spot the issue?

Thanks,

Max R.

Sr. Software Tech



JNI Native - System (java.lang.System)

2018-08-02 Thread mr rupplin
Hello.

Trying to run a simple JNI call and I keep getting the following:

SecureJVM : GNU Public License 2.0
Program Name >> java
Launcher Name >> openjdk
Windows >> off
Version >> 9-internal+0-adhoc.mearvk.jdk9

A new instance of Hope is born.
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
at Hope.(Hope.java:19)


The source looks like:

public static void setMemoryAllocationListener(MemoryAllocationListener 
memoryAllocationListener) {
checkMalloc();
setMemoryAllocationListener0(memoryAllocationListener);
}


The C source looks like:


JNIEXPORT void JNICALL
Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
jobject listener)
{
printf("setMemoryAllocationListener called:\n");

jfieldID fid =

(*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");

printf("\t >> Lookup of MemoryAllocationListener completed");

if (fid == 0)
return;


(*env)->SetStaticObjectField(env,cla,fid,listener);

printf("\t >> SetStaticObjectField completed");
}


I am unable to discern the problem.  The make runs clean as does a non-native 
call that instantiates a MemoryAllocationListener object.

Can you guys spot the issue?

Thanks,

Max R.

Sr. Software Tech