I have to write some little programs in Java for school, so I don't want all that stuff that Eclipse generates with a new project. The way I'm doing it now is this:
$ touch myprog.java$ javac myprog.java$ java MyProgClassThe problem is that Eclipse doesn't show warnings and errors while typing the code. It would also be nice if it would let me compile and run the file inside Eclipse (by doing what I do above in the working directory).
Is there any way I can make Eclipse do this?
This is because Eclipse doesn't consider your .java file as something it should compile (and thus generate errors for)
You need to mark the folder containing myprog.java as a source folder. Here's how you do it:
Right-click on the folder and choose "Build Path" -> "Use as source folder".
Well because now it's just a text file for eclipse and it isn't linked to java project.
Create new project and put myprog.java to /src folder in eclipse project.
Then:
$ javac workspace/yourpoject/src/myprog.java
$ java workspace/yourproject/bin/myprog
As a result copy only those 2 files and ignore the rest of project files if you want.
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