How to Compile JNI in Ubuntu
- 1). Click the Ubuntu symbol in the upper left corner of the screen and type "Java" in the search bar and open your Java editor. If you do not have one yet, there are several you can choose from, including jEdit, Eclipse and DrJava. Installing each may require a different process.
- 2). Enter your program in the window. A popular one for Java beginners is the "Hello World" program, which looks like this:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Press the "Save" button and save it in the " ~username/introcs/hello" directory. Replace "username" with your username on the computer. - 3). Open your terminal window by holding down the "Ctrl", "Alt" keys and and pressing "T". Enter the following commands to move into the right directory and compile your program:
cd ~/introcs/hello
javac HelloWorld.java
When the output from the compilation finishes and you have a command prompt again, enter the next one to run the program:
java HelloWorld
Source...