英文:
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:
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论