Here's what I've got:
TestFile.java
with the same class name.main()
method.However, when I drag and drop(or open) the file into Eclipse and try to Run As
, I don't get Run As Java Application
or anything that can run that single/independent(of any project) Java file/class.
When I try to just Run
, I get a pop-up saying "Run As Ant Build
. Now, I never setup ant build.
All I want is to run just one this Java file and see the output/error in Console
that is visible just below the editor in perspective.
I didn't and don't intend to write/setup a full fledged Java project with package name and all, in which case Run as Java Application
simply comes. I just want to run one independent Java class/file in Eclipse with a main()
method in it.
I am on Mac. If there's any other app/IDE which does that for Java and/or other languages then I think that will be very useful.
Update: I created a Java project in Eclipse and a test.java
inside that and I keep changing/editing/adding in the same file whenever I need to write a quick code and run it. No way to really drag-drop-run in Eclipse.
You can't compile & run just one file in Eclipse without the file being in a java project.
It is a very quick and easy process to create a Java Project in eclipse.
File -> New -> Java Project
You can use the default package (though it is not recommended) and put your single file in it and run it.
Try jGRASP, it's a really simple editor and compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With