How to run a Java project on Linux without using an IDE

I am new to Java. Basically, I developed Java projects that contain several Java packages inside Eclipse. The project runs on my desktop with Redhat Linux installed. However, I need to run it on a more powerful Linux server (Redhat Enterprise Linux) that does not have X11. Therefore, running Eclipse on this server is not possible. Can this be done? If so, how can I move the entire project to this server, including input and output folders?

thanks

+4
source share
3 answers

In Eclipse, use the "Export Runnable Jar" option. Select your project, then click file-> Export, select Java, select Runnable Jar file. Otherwise, you can also use the javac compiler to compile your project and run it using the java command and the main class.

+3
source

You will need to install the JRE on the machine on which you want to run it. This can be done using the following command:

 yum install java-1.6.0-openjdk* 

Once you have Java, it is just a matter of executing your application. I would recommend using eclipse to compile your project into a jar and use the following command to execute it:

 java -jar *JarFileName*.jar 
0
source

Running Java has nothing to do with Eclipse. You can run your java program on a Linux machine by opening a terminal.

Step 1; - Install JAVA_HOME in your bash profile.

Step 2: - open a terminal, go to the folder or package where your main program is present.

Step 3: - compile it with javac -cp lib.jar Filename.java

Step 4: - After the compilation class file is available, run it using java filename.java

Typically, an IDE, such as eclipse, is designed to be developed not to run the application, but the Linux version of eclipse is also available.

http://eclipse.org/downloads/?osType=linux

0
source

Source: https://habr.com/ru/post/1481827/


All Articles