I am working with sample code from another StackOverflow post - Java - How to take a screenshot fast, but I'm having some issues.
I downloaded the JNA files from its Github repository, then copied the file inside the JAR file and put it into the same folder where my program is. But when I try to compile my program, it give me a lot of error as shown at below:
C:\Users\windows\Desktop\testPrintScreen>javac JNAScreenShot.java
JNAScreenShot.java:12: error: package com.sun.jna.platform.win32 does not exist
import com.sun.jna.platform.win32.W32API;
^
JNAScreenShot.java:129: error: package com.sun.jna.platform.win32 does not exist
interface GDI32 extends com.sun.jna.platform.win32.GDI32 {
^
JNAScreenShot.java:58: error: cannot find symbol
bufferedImageFromBitmap(GDI32.HDC blitDC,
^
symbol: class HDC
location: interface GDI32
JNAScreenShot.java:59: error: cannot find symbol
GDI32.HBITMAP outputBitmap,
^
symbol: class HBITMAP
location: interface GDI32
JNAScreenShot.java:60: error: cannot find symbol
GDI32.BITMAPINFO bi) {
^
symbol: class BITMAPINFO
location: interface GDI32
JNAScreenShot.java:151: error: package com.sun.jna.platform.win32 does not exist
interface User32 extends com.sun.jna.platform.win32.User32 {
Does anyone know what is happening? Is it the import part that is causing problems? These are my imports:
import com.sun.jna.Native;
import com.sun.jna.platform.win32.W32API;
import com.sun.jna.win32.W32APIOptions;