ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
could anyone suggest an editor (or IDE)to
write java code and compile and debug java programs.
i have used vi for a very short time, for c programming, it is fast. i tried to use it for java, the editing part was fine. but when it came to running the code, i got stuck with it. i don't want to open another terminal and then compile.
would emacs be a better choice?
sometimes i just want to write a single class and test run it. i don't want to generate a lot of project settings files (like the IDEs do).
what about emacs? i have heard of it but never used it.
if you just want to compile real quick without having a second terminal or exiting vi all you gotta do is write a script that will compile and execute you java projects, kinda like a make file, i wrote a tiny script if you want, actually two, "short" is supposed to just compile all the java files under the directory, it will not run the main file; "run" is the file that compiles all java files, makes a jar file (executable with a double click), executes program, and removes all temp files and class files (clean up). here they are:
to execute from vi, just enter command mode with escape and then type ":!run" or ":!short", you'll see your files compile and after execution of the script file, you'll be asked to press enter.
one last thing, i suggest you copy these 2 files to all your projects, and have each project in a different directory because, the script is going to look for the main file which i always name Driver.java, if you want to name your main class something else, then just change it in the run script: on the line that says Main-Class, just change "Driver" with the name of your main file without the .java extension
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.