Reputation: 9478
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
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
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
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
Reputation: 887453
Right-click your Eclipse project, Build Path, Configure Build Path, Libraries, Add (External?) Class Folder.
Upvotes: 2