I created a little JFrame program which works fine in IDEA and on my PC in general, the problem is when someone without JDK tries to run my program they get the error:
"A jni error has occurred please check your installation and try again".
I was able to recreate the error by simply moving my JDK to my desktop or somewhere else, but for some reason even reproducing it on my PC does not work.
I am using a normal project in created in IDEA.
I also googled for solutions but wasn't able to find anything that fixes my problem.
EDIT: I already tried to bundle my exe with JRE but it did not work.
EDIT 2: To reproduce this error I wrote this small code:
import javax.swing.*;
import java.net.URISyntaxException;
public class HelloWorld {
public static void main(String[] args){
JFrame testframe= new JFrame("test");
testframe.setSize(100, 100);
testframe.setVisible(true);
}
}
After creating a JAR file I used Launch4j to create an executable file. Also made it so it has jre coming with it. If I now send someone else my exe file or move my JDK to my desktop it gives me the previously mentioned error. If someone installs JDK it works fine for him too.