Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I compile a Java program in Eclipse without running it?

I would like to compile my Java program in Eclipse but not to run it. I can't understand how to do it.

How can I compile a Java program to .class files in Eclipse without running it?

like image 546
Jonas Avatar asked Oct 30 '10 10:10

Jonas


People also ask

How do I compile a single Java file in Eclipse?

Your class has to define a public static void main(String[] args) method. Then find the Java file in the project explorer, right-click on it, and choose "run as Java application". The file name has to be the same (+ extension ".

Can you run a Java file without compiling it?

Starting with Java SE 11 and for the first time in the programming language's history, you can execute a script containing Java code directly without compilation. The Java 11 source execution feature makes it possible to write scripts in Java and execute them directly from the *inx command line.


1 Answers

You can un-check the build automatically in Project menu and then build by hand by type Ctrl + B, or clicking an icon the appears to the right of the printer icon.

like image 92
Cristina Avatar answered Sep 21 '22 10:09

Cristina