Bonjour,

Avant tout, je tiens à m'excuser si l'endroit où je poste ma question n'est pas le bon. Je suis vraiment novice en programmation et je souhaite importer des librairies .dll éditées avec du code C# sous Java. Je fais donc suite au tutoriel du lien suivant :

https://mbaron.developpez.com/tutori...-avec-jni-jna/

Je bloque complet pour générer le Header C/C++ de la partie "IV-B. Générer le header C/C++".

Pour vous situer le contexte, j'ai crée sous éclipse un projet en Java avec une classe nommée Interface_C qui contient le code le plus simple possible suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
public class Interface_C {
	public static final native int AfficherMessage();
}
Ensuite, comme dit dans ce tutoriel, j'essaie de créer le header C/C++ avec la commande suivante dans mon terminal Windows :

( Je n'utilise pas le javah car visiblement avec les mises à jour la commande javac remplace la commande javah).

Et la, une erreur m'est retournée. Ci dessous l'erreur que j'ai :

Code x : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff81c2aae4e, pid=16232, tid=6504
#
# JRE version:  (14.0+36) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14+36-1461, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V  [jvm.dll+0x28ae4e]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Pierre Bresson\eclipse\Hello_World\bin\hs_err_pid16232.log
#
#

Je vous poste aussi le fichier log indiqué dans cette erreur ("hs_err_pid16232.log") :

Code x : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff81c2aae4e, pid=16232, tid=6504
#
# JRE version:  (14.0+36) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14+36-1461, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V  [jvm.dll+0x28ae4e]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
#

---------------  S U M M A R Y ------------

Command Line: -Dapplication.home=C:\Program Files\Java\jdk-14 --add-modules=ALL-DEFAULT -Xms8m -Djdk.module.main=jdk.compiler jdk.compiler/com.sun.tools.javac.Main Interface_C

Host: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, 4 cores, 7G,  Windows 10 , 64 bit Build 18362 (10.0.18362.329)
Time: Sun Mar 22 17:30:24 2020 Paris, Madrid elapsed time: 0 seconds (0d 0h 0m 0s)

---------------  T H R E A D  ---------------

Current thread (0x0000029ec5a24800):  JavaThread "Unknown thread" [_thread_in_vm, id=6504, stack(0x000000a509f00000,0x000000a50a000000)]

Stack: [0x000000a509f00000,0x000000a50a000000],  sp=0x000000a509fff440,  free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x28ae4e]
V  [jvm.dll+0x28b285]
V  [jvm.dll+0x5a7f39]
V  [jvm.dll+0x5a8109]
V  [jvm.dll+0x5a79ab]
V  [jvm.dll+0x5a2245]
V  [jvm.dll+0x71f74b]
V  [jvm.dll+0x321c24]
V  [jvm.dll+0x700aec]
V  [jvm.dll+0x392ddf]
V  [jvm.dll+0x394e51]
C  [jli.dll+0x523b]
C  [ucrtbase.dll+0x20e72]
C  [KERNEL32.DLL+0x17bd4]
C  [ntdll.dll+0x6ced1]


siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000


Registers:
RAX=0x00007201eafbae6c, RBX=0x0000000000000000, RCX=0x0000000000000000, RDX=0x00007ff81c868a01
RSP=0x000000a509fff440, RBP=0x0000000000000001, RSI=0x0000000800a96f30, RDI=0x0000000000000000
R8 =0x0000000000000001, R9 =0x0000000000000001, R10=0x0000029ec5aa3790, R11=0x000000a509fff370
R12=0x0000000000000000, R13=0x0000029ec5918bf0, R14=0x0000000000000001, R15=0x000000a509fffc98
RIP=0x00007ff81c2aae4e, EFLAGS=0x0000000000010246

Top of Stack: (sp=0x000000a509fff440)
0x000000a509fff440:   0000029ec5aa45b0 0000000000000000
0x000000a509fff450:   0000000000010000 00007ff833995200
0x000000a509fff460:   0000000000000000 00007ff8339d4a3e
0x000000a509fff470:   0000000000000003 0000000800000000
0x000000a509fff480:   00007201eafba9ec 0000000000000000
0x000000a509fff490:   00007201eafbae6c 0000000800000000
0x000000a509fff4a0:   0000000000000000 00007ff81c2ab285
0x000000a509fff4b0:   00000000000000d8 0000000000000000
0x000000a509fff4c0:   0000000000000000 0000029ec5a61860
0x000000a509fff4d0:   0000000800a96f28 0000000000000001
0x000000a509fff4e0:   0000000000000004 000000a509fff660
0x000000a509fff4f0:   0000000000000000 0000000000000000
0x000000a509fff500:   0000000000000000 0000000000000000
0x000000a509fff510:   ffffffff45524a00 313634312d363300
0x000000a509fff520:   00007201eafbae9c 0000000800000000
0x000000a509fff530:   0000029ec5918bf0 0000000800000000 

Instructions: (pc=0x00007ff81c2aae4e)
0x00007ff81c2aad4e:   ff 85 d2 44 0f 4f c2 49 63 d0 41 b8 02 00 00 00
0x00007ff81c2aad5e:   48 83 c2 0f 48 c1 ea 03 48 63 d2 e8 12 61 31 00
0x00007ff81c2aad6e:   48 8b d8 48 85 c0 74 0b 89 38 eb 09 41 c6 04 24
0x00007ff81c2aad7e:   02 eb 1b 33 db 4c 63 84 24 80 00 00 00 48 8d 4b
0x00007ff81c2aad8e:   04 48 8b d5 e8 3f a0 50 00 49 89 5c 24 20 48 8b
0x00007ff81c2aad9e:   9c 24 88 00 00 00 49 83 3e 00 74 15 48 8b 54 24
0x00007ff81c2aadae:   28 48 8b ce e8 d9 16 e2 ff 49 8b ce e8 41 16 e2
0x00007ff81c2aadbe:   ff 48 89 5e 20 48 8b 5c 24 70 4c 89 76 10 4c 89
0x00007ff81c2aadce:   6e 18 48 83 c4 30 41 5f 41 5e 41 5d 41 5c 5f 5e
0x00007ff81c2aadde:   5d c3 40 53 48 83 ec 20 48 8b 59 28 e8 b1 cc 36
0x00007ff81c2aadee:   00 ff c8 48 63 c8 48 8d 04 19 48 f7 d1 48 23 c1
0x00007ff81c2aadfe:   48 83 c4 20 5b c3 cc cc cc cc cc cc cc cc cc cc
0x00007ff81c2aae0e:   cc cc 48 89 5c 24 10 48 89 6c 24 18 48 89 74 24
0x00007ff81c2aae1e:   20 57 48 83 ec 60 48 8b 05 ed 99 76 00 48 33 c4
0x00007ff81c2aae2e:   48 89 44 24 50 80 3d 28 6c 73 00 00 0f b6 ea 48
0x00007ff81c2aae3e:   8b f1 74 17 80 39 00 75 12 48 8b 0d 8a 48 79 00
0x00007ff81c2aae4e:   48 8b 01 ff 50 20 48 8b d8 eb 08 48 8b 59 18 48
0x00007ff81c2aae5e:   83 c3 04 48 83 3d 67 49 79 00 00 40 b7 01 74 0f
0x00007ff81c2aae6e:   48 8b d3 48 8d 0d 90 d8 5b 00 e8 83 53 f3 ff 48
0x00007ff81c2aae7e:   8d 54 24 20 48 8b cb e8 16 c1 36 00 85 c0 74 19
0x00007ff81c2aae8e:   40 84 ed 74 14 48 8b d3 48 8d 0d 93 d8 5b 00 e8
0x00007ff81c2aae9e:   0e de ff ff 40 32 ff eb 78 80 3e 03 75 20 48 8b
0x00007ff81c2aaeae:   cb e8 7c 6d 36 00 84 c0 75 67 48 8b d3 48 8d 0d
0x00007ff81c2aaebe:   9e d8 5b 00 e8 e9 dd ff ff 40 32 ff eb 53 48 8b
0x00007ff81c2aaece:   56 08 4c 8b 44 24 40 48 85 d2 74 05 49 3b d0 75
0x00007ff81c2aaede:   09 8b 44 24 34 39 46 10 74 37 40 32 ff 40 38 3d
0x00007ff81c2aaeee:   63 63 7b 00 74 1c 49 3b d0 48 8d 05 82 d8 5b 00
0x00007ff81c2aaefe:   48 8d 0d 93 d8 5b 00 48 0f 45 c8 e8 a2 dd ff ff
0x00007ff81c2aaf0e:   eb 0f 48 8b d3 48 8d 0d 96 d8 5b 00 e8 91 dd ff
0x00007ff81c2aaf1e:   ff 80 3d 2f 63 7b 00 00 74 10 40 84 ff 75 0b c6
0x00007ff81c2aaf2e:   05 25 b2 7c 00 01 b0 01 eb 04 40 0f b6 c7 48 8b
0x00007ff81c2aaf3e:   4c 24 50 48 33 cc e8 f7 87 50 00 4c 8d 5c 24 60 



---------------  P R O C E S S  ---------------

Threads class SMR info:
_java_thread_list=0x00007ff81caa4078, length=0, elements={
}

Java Threads: ( => current thread )

Other Threads:
  0x0000029ec5a5f800 GCTaskThread "GC Thread#0" [stack: 0x000000a50a000000,0x000000a50a100000] [id=1760]
  0x0000029ec5a72800 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000a50a100000,0x000000a50a200000] [id=1872]
  0x0000029ec5a74800 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000a50a200000,0x000000a50a300000] [id=16408]
  0x0000029ec5a90800 ConcurrentGCThread "G1 Refine#0" [stack: 0x000000a50a300000,0x000000a50a400000] [id=11172]
  0x0000029ec5a92000 ConcurrentGCThread "G1 Young RemSet Sampling" [stack: 0x000000a50a400000,0x000000a50a500000] [id=1240]

=>0x0000029ec5a24800 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=6504, stack(0x000000a509f00000,0x000000a50a000000)]

Threads with active compile tasks:

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

Heap address: 0x0000000082000000, size: 2016 MB, Compressed Oops mode: 32-bit
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Classes unloaded (0 events):
No events

Classes redefined (0 events):
No events

Internal exceptions (0 events):
No events

Events (2 events):
Event: 0.007 Loaded shared library C:\Program Files\Java\jdk-14\bin\java.dll
Event: 0.008 Loaded shared library C:\Program Files\Java\jdk-14\bin\zip.dll


Dynamic libraries:
0x00007ff6ab7e0000 - 0x00007ff6ab7e7000 	C:\Program Files\Java\jdk-14\bin\javac.exe
0x00007ff836140000 - 0x00007ff836330000 	C:\WINDOWS\SYSTEM32\ntdll.dll
0x00007ff835a70000 - 0x00007ff835b22000 	C:\WINDOWS\System32\KERNEL32.DLL
0x00007ff833970000 - 0x00007ff833c13000 	C:\WINDOWS\System32\KERNELBASE.dll
0x00007ff8330f0000 - 0x00007ff8331ea000 	C:\WINDOWS\System32\ucrtbase.dll
0x00007ff822ac0000 - 0x00007ff822ad8000 	C:\Program Files\Java\jdk-14\bin\jli.dll
0x00007ff822c60000 - 0x00007ff822c75000 	C:\Program Files\Java\jdk-14\bin\VCRUNTIME140.dll
0x00007ff8357a0000 - 0x00007ff835843000 	C:\WINDOWS\System32\ADVAPI32.dll
0x00007ff8346b0000 - 0x00007ff83474e000 	C:\WINDOWS\System32\msvcrt.dll
0x00007ff835700000 - 0x00007ff835797000 	C:\WINDOWS\System32\sechost.dll
0x00007ff834590000 - 0x00007ff8346b0000 	C:\WINDOWS\System32\RPCRT4.dll
0x00007ff8342c0000 - 0x00007ff834454000 	C:\WINDOWS\System32\USER32.dll
0x00007ff833c20000 - 0x00007ff833c41000 	C:\WINDOWS\System32\win32u.dll
0x00007ff8350a0000 - 0x00007ff8350c6000 	C:\WINDOWS\System32\GDI32.dll
0x00007ff80fcb0000 - 0x00007ff80ff35000 	C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.720_none_e6beb5c51314836b\COMCTL32.dll
0x00007ff833eb0000 - 0x00007ff834044000 	C:\WINDOWS\System32\gdi32full.dll
0x00007ff835dc0000 - 0x00007ff8360f6000 	C:\WINDOWS\System32\combase.dll
0x00007ff834050000 - 0x00007ff8340ee000 	C:\WINDOWS\System32\msvcp_win.dll
0x00007ff833c50000 - 0x00007ff833cd0000 	C:\WINDOWS\System32\bcryptPrimitives.dll
0x00007ff82af20000 - 0x00007ff82af2a000 	C:\WINDOWS\SYSTEM32\VERSION.dll
0x00007ff835d90000 - 0x00007ff835dbe000 	C:\WINDOWS\System32\IMM32.DLL
0x00007ff81f190000 - 0x00007ff81f22b000 	C:\Program Files\Java\jdk-14\bin\msvcp140.dll
0x00007ff81c020000 - 0x00007ff81cb3f000 	C:\Program Files\Java\jdk-14\bin\server\jvm.dll
0x00007ff8356f0000 - 0x00007ff8356f8000 	C:\WINDOWS\System32\PSAPI.DLL
0x00007ff82bcb0000 - 0x00007ff82bcd4000 	C:\WINDOWS\SYSTEM32\WINMM.dll
0x00007ff80d220000 - 0x00007ff80d229000 	C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x00007ff834460000 - 0x00007ff8344cf000 	C:\WINDOWS\System32\WS2_32.dll
0x00007ff82bc60000 - 0x00007ff82bc8d000 	C:\WINDOWS\SYSTEM32\WINMMBASE.dll
0x00007ff8340f0000 - 0x00007ff83413a000 	C:\WINDOWS\System32\cfgmgr32.dll
0x00007ff833060000 - 0x00007ff833071000 	C:\WINDOWS\System32\kernel.appcore.dll
0x00007ff822cb0000 - 0x00007ff822cba000 	C:\Program Files\Java\jdk-14\bin\jimage.dll
0x00007ff82aca0000 - 0x00007ff82ae94000 	C:\WINDOWS\SYSTEM32\DBGHELP.DLL
0x00007ff829bb0000 - 0x00007ff829bda000 	C:\WINDOWS\SYSTEM32\dbgcore.DLL
0x00007ff822a90000 - 0x00007ff822ab5000 	C:\Program Files\Java\jdk-14\bin\java.dll
0x00007ff822a70000 - 0x00007ff822a87000 	C:\Program Files\Java\jdk-14\bin\zip.dll

dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-14\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.720_none_e6beb5c51314836b;C:\Program Files\Java\jdk-14\bin\server

VM Arguments:
jvm_args: -Dapplication.home=C:\Program Files\Java\jdk-14 --add-modules=ALL-DEFAULT -Xms8m -Djdk.module.main=jdk.compiler 
java_command: jdk.compiler/com.sun.tools.javac.Main Interface_C
java_class_path (initial): <not set>
Launcher Type: SUN_STANDARD

[Global flags]
     intx CICompilerCount                          = 3                                         {product} {ergonomic}
     uint ConcGCThreads                            = 1                                         {product} {ergonomic}
     uint G1ConcRefinementThreads                  = 4                                         {product} {ergonomic}
   size_t G1HeapRegionSize                         = 1048576                                   {product} {ergonomic}
    uintx GCDrainStackTargetSize                   = 64                                        {product} {ergonomic}
   size_t InitialHeapSize                          = 8388608                                   {product} {command line}
   size_t MarkStackSize                            = 4194304                                   {product} {ergonomic}
   size_t MaxHeapSize                              = 2113929216                                {product} {ergonomic}
   size_t MaxNewSize                               = 1267728384                                {product} {ergonomic}
   size_t MinHeapDeltaBytes                        = 1048576                                   {product} {ergonomic}
   size_t MinHeapSize                              = 8388608                                   {product} {command line}
    uintx NonNMethodCodeHeapSize                   = 5832780                                {pd product} {ergonomic}
    uintx NonProfiledCodeHeapSize                  = 122912730                              {pd product} {ergonomic}
    uintx ProfiledCodeHeapSize                     = 122912730                              {pd product} {ergonomic}
    uintx ReservedCodeCacheSize                    = 251658240                              {pd product} {ergonomic}
     bool SegmentedCodeCache                       = true                                      {product} {ergonomic}
   size_t SoftMaxHeapSize                          = 2113929216                             {manageable} {ergonomic}
     bool UseCompressedClassPointers               = true                                 {lp64_product} {ergonomic}
     bool UseCompressedOops                        = true                                 {lp64_product} {ergonomic}
     bool UseG1GC                                  = true                                      {product} {ergonomic}
     bool UseLargePagesIndividualAllocation        = false                                  {pd product} {ergonomic}

Logging:
Log output configuration:
 #0: stdout all=warning uptime,level,tags
 #1: stderr all=off uptime,level,tags

Environment Variables:
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\MinGW\bin;C:\Program Files\Java\jdk-14\bin\;C:\cygwin64\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\MATLAB\R2017b\runtime\win64;C:\Program Files\MATLAB\R2017b\bin;C:\Program Files\MATLAB\R2016a\runtime\win64;C:\Program Files\MATLAB\R2016a\bin;C:\Program Files\MATLAB\R2016a\polyspace\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\IVI Foundation\IVI\bin;C:\Program Files\IVI Foundation\IVI\bin;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn;C:\Cadence\SPB_16.6\openaccess\bin\win32\opt;C:\Cadence\SPB_16.6\tools\capture;C:\Cadence\SPB_16.6\tools\pspice;C:\Cadence\SPB_16.6\tools\specctra\bin;C:\Cadence\SPB_16.6\tools\fet\bin;C:\Cadence\SPB_16.6\tools\libutil\bin;C:\Cadence\SPB_16.6\tools\bin;C:\Cadence\SPB_16.6\tools\pcb\bin;C:\Users\Pierre Bresson\AppData\Roaming\Dashlane\4.6.6.23032\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\Pierre Bresson\AppData\Local\Microsoft\WindowsApps;C:\Users\Pierre Bresson\AppData\Roaming\Dashlane\5.14.0.21388\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\Pierre 
USERNAME=Pierre Bresson
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 9, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 10 , 64 bit Build 18362 (10.0.18362.329)
OS uptime: 0 days 6:42 hours

CPU:total 4 (initial active 4) (2 cores per cpu, 2 threads per core) family 6 model 142 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx, fma

Memory: 4k page, system-wide physical 8060M (2888M free)
TotalPageFile size 12924M (AvailPageFile size 6545M)
current process WorkingSet (physical memory assigned to process): 10M, peak: 10M
current process commit charge ("private bytes"): 71M, peak: 71M

vm_info: Java HotSpot(TM) 64-Bit Server VM (14+36-1461) for windows-amd64 JRE (14+36-1461), built on Feb  6 2020 19:08:04 by "mach5one" with MS VC++ 15.9 (VS2017)

END.


En attendant de vous lire,

Je vous souhaite a tous une très bonne soirée,

Bien cordialement,

Bresson Pierre