How to use Javaw on windows JNI error has occurred Intellij IDEA to run GUI without console window

727 Views Asked by At

So I have a jar file that has been built as an artifact from Intellij IDEA and I want to be able to run it with javaw so that the console is not visible.

I think that this should work, but for some reason it spits out a JNI error.

Error: A JNI error has occurred, please check your installation and try again

"C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" -jar my.jar -Xms1024m -Xmx1024m -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm

Same happens with

javaw -jar ftExoWebManager.jar -Xms1024m -Xmx1024m -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm

The below command does work and program runs fine but it shows the console window.

java -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm

The only version of java installed is Oracle Java 1.8.0_191

java -showversion
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Any thoughts on how to accomplish this, do I need to install a different java version to fix javaw or change something obscure in the Java programs code?

Thanks.

0

There are 0 best solutions below