1

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.

Liam Mitchell
  • 1,001
  • 13
  • 23
  • What is the exact error that you get? – CrazyCoder Apr 17 '19 at 03:11
  • Its a useless error message. "Error: A JNI error has occurred, please check your installation and try again" – Liam Mitchell Apr 17 '19 at 05:15
  • I can't reproduce it. You may have a broken JDK installation. Try removing all Java versions from your system and install a new one. – CrazyCoder Apr 17 '19 at 05:17
  • I can't remove the program files stuff it is a remote machine controlled by another organization I only have a limited remote desktop user :(. Can I install Java portable somehow to rule this out? – Liam Mitchell Apr 17 '19 at 05:21
  • 1
    Yes, you can get some Java distribution in .zip format and use it to run your app: https://bintray.com/jetbrains/intellij-jdk/ contains Java runtimes used by IntelliJ IDEA for different platforms including Windows. – CrazyCoder Apr 17 '19 at 05:25
  • Thanks CrazyCoder, not sure if that is what I am after however need actual Java to run the jar as a GUI. Found https://portableapps.com/apps/utilities/java_portable but not sure if can trust it looks sketchy to me, OpenJDK comes in a zip file I'll try that maybe... :) – Liam Mitchell Apr 17 '19 at 05:51

0 Answers0