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

I would like to compile my Java program in Eclipse, but not run it. I canโ€™t figure out how to do this.

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

+76
java eclipse compilation .class-file
Oct 30 '10 at 10:01
source share
7 answers

You can automatically cancel the assembly in the "Project" menu, and then create manually by type Ctrl + B or click the icon to the right of the printer icon.

+35
Oct 30 '10 at 10:06
source share

You will need to go to Project-> Clean ... and then build your project. This will work even if the source code does not contain any basic method to run as an executable program. The .class files will appear in the bin folder of your project in the workspace.

+7
Aug 14 '12 at 22:14
source share

Right click on Yourproject(in project Explorer)-->Build Project

It will compile all the files in your project and update your build folder without launching.

+3
Apr 19 '14 at 11:35
source share

If you delete your .class file in Eclipse, and then try to create it again from the .java file, it will do nothing. If you try to run the .java file without the .class file, you will receive an error message that it cannot find the main class.

You will have to either modify or save the .java file and then create it again, otherwise you must run Clean in the project and then create it again.

+2
Apr 11 '13 at
source share

Go to the project explorer block ... right-click on the project name select "Build Path" -----------> "Build Path Configuration"

a popup will open.

In this popup you will find 4 tabs. 1) source 2) project 3) Library 4) order and export

Click 1) Source

select the project (under which this file is present, which you want to compile)

and then click ok.

Go to the location of the project workspace, open the bin folder and find this class file ...

you will get this java file compiled ...

just cross-checking checks the changed time.

hope this helps.

Thank.

+2
Dec 04 '13 at 5:54 on
source share

Try this in the console:

 javac {$PathToYourProyect}/* 

If you also need an external library, try:

 javac -cp {$PathToYourLibrary}.jar {$PathToYourProyect}/* 
+2
Oct 21 '15 at 10:12
source share

Right-click on the file in the package explorer. Then go to Show in. Under it go to the terminal. Eclipse will have a terminal, then Use javac fileName to compile

0
Oct 28 '17 at 6:34 on
source share



All Articles