Logan Clough
Logan Clough

Reputation: 1

whenever I compile I get A jni error has occurred

I am completely new to java and have no idea what I'm doing. I wrote a very simple Hello World program and tried to compile it but when i tried to open the jar I got a Jni error has occurred message what should I do.

public class helloWorld {
 public static void main(String[] args) {

System.out.println("Hello world");
}
}

Upvotes: 0

Views: 66

Answers (2)

vladzaba
vladzaba

Reputation: 1402

If you want to run it through command line, just do this:

javac helloWorld.java or java -jar helloWorld.jar (depends what you have)

Or if you want to make exe file from jar, so you just need double click it to open, use:

http://launch4j.sourceforge.net

Upvotes: 1

牛梓名
牛梓名

Reputation: 1

You can't just open the jar to run this code, at first you need a java runtime environment, and if you want to use command line to run this code, you can use java -c helloWorld.java java helloWorld to run it.

Upvotes: 0

Related Questions