fanchyna
fanchyna

Reputation: 2713

How to Run a Java Project on Linux Without Using IDE

I am new to Java. Basically, I developed a java projects which contains multiple Java packages inside Eclipse. The project runs OK on my desktop with a redhat Linux installed. However, I need to run it on a more powerful Linux server (redhat enterprise Linux) which does not have X11 installed. Therefore, it is impossible to run Eclipse on that server. Is it possible to do that? If so, how can I move the entire project to that server including the input and output folders?

Thanks

Upvotes: 6

Views: 10510

Answers (3)

Sumeet Kumar Yadav
Sumeet Kumar Yadav

Reputation: 1

Running Java is nothing to do with Eclipse . You can run your java program in linux machine by opening terminal .

Step1;- Set your JAVA_HOME in your bash profile .

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

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

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

Usually IDE like eclipse is for development not for running the application , but Linux version of eclipse is also available

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

Upvotes: 0

user2403009
user2403009

Reputation:

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

yum install java-1.6.0-openjdk*

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

java -jar *JarFileName*.jar

Upvotes: 0

Kyle
Kyle

Reputation: 4298

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

Upvotes: 4

Related Questions