After importing into eclipse using eGit, it is not possible to compile and run. What am I doing?

After importing a standard .java file into Eclipse using Git, I tried to compile and run the file. Eclipse gave me this error:

"Unable to launch: The selection cannot be launched, and there are no recent launches." 

What should I do?

+6
source share
3 answers

You need to make sure your java code is in a java project. If the git source is created from ant, there is a project called "File> New> Other ..> Java from the ant build file."

Otherwise, you need to create a java project in eclipse, and then 1) import the source code into the proj / src directory or 2) create a linked folder in the eclipse that points to the original location on the file system.

Then you need to configure the class path (add all the jars needed for compilation).

+5
source

Not really git-related, I don't think so. You just need to say which file to run. Right-click the file with the main () function in it and click "Run As ..."> Java Application

0
source

On the last screen of the Eclipse "Clone Git Repository" wizard, make sure that "Import all existing Eclipse projects after cloning is complete."

(Perhaps this option was unavailable 4 years ago when the question was posted.)

0
source

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


All Articles