每当我编译时都会出现”JNI错误已发生”。

huangapple go评论70阅读模式
英文:

whenever I compile I get A jni error has occurred

问题

我完全不了解Java,不知道自己在做什么。我写了一个非常简单的Hello World程序,尝试编译它,但是当我尝试打开这个jar文件时,我收到了一个"发生了Jni错误"的消息,我该怎么办。

public class helloWorld {
    public static void main(String[] args) {
        System.out.println("Hello world");
    }
}
英文:

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");
}
}

答案1

得分: 1

如果您想通过命令行运行它,只需执行以下操作:

javac helloWorld.java 或者 java -jar helloWorld.jar(取决于您拥有什么)

或者如果您想从jar文件制作exe文件,以便您只需双击它即可打开,请使用:

http://launch4j.sourceforge.net

英文:

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

答案2

得分: 0

你不能只是打开罐子来运行这段代码,首先你需要一个Java运行时环境,如果你想要使用命令行来运行这段代码,
你可以使用
java -c helloWorld.java
java helloWorld
来运行它。

英文:

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.

huangapple
  • 本文由 发表于 2020年9月27日 10:28:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/64084222.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定