Sahil
Sahil

Reputation: 9478

How to run a external .class file in eclipse?

I am taking a course on Coursera and as part of a quiz I am supposed to download their xyz.class and run it. I want to do it in eclipse as all of jar files are added in eclipse and I dont want to modify the class path of system as it is very untidy.

But I dont know how to run a external .class file through?Can anyone help me with that?

Upvotes: 0

Views: 23019

Answers (5)

gautam
gautam

Reputation: 1

goto file >> new project >> Import>> add executable jar files >> select your path where you have stored your .class files>> check include in work place

apply>> ok >>>>>>>>>>>>>>>>>>>>Done

Upvotes: 0

Manuel Selva
Manuel Selva

Reputation: 19050

Why do you want to run it in Eclipse ?

java classname

souhld do the trick. You can't use Eclipse to run an external class file with a main method without creatin a java project with this class in its class path.

Upvotes: 3

Siva Charan
Siva Charan

Reputation: 18064

Just run

java xyz

eclipse might not required.

If you want to really work out through the eclipse then refer How do I include .class files in my project in Eclipse? (Java) answer.

There is another way of approach without using eclipse.

Approach is by creating a executable jar file and by including all required libraries & xyz.class.

Upvotes: 1

mtk
mtk

Reputation: 13709

Right click on the class file from the Package Explorer -> Run.

Upvotes: 0

SLaks
SLaks

Reputation: 887453

Right-click your Eclipse project, Build Path, Configure Build Path, Libraries, Add (External?) Class Folder.

Upvotes: 2

Related Questions