PDA

View Full Version : Editor with built-in compiler?




pixelbaker
Feb 20, 2008, 07:12 PM
I'm in an application development class learning the very basics of java. I've been using TextMate for my coding purposes, but now my simple apps need to be able to request input in a command line form and then return results based on it.

I can compile and run, but it won't request that info and then keep running.

Somebody said that I need to just run it through the command line and I was hoping to do that, but I'm not really sure how. I also compile quite often and it would be nice to have a shortcut key to do it

Is there some other editor that has this functionality? I don't mind Eclipse/NetBeans/XCode but they seem like overkill for the stuff I'm doing.

Thanks in advance



Cromulent
Feb 20, 2008, 07:33 PM
Just use the Terminal to execute your program. You will obviously need to write your program to take input from the standard input and the write and information you need back to the standard output. If you are having problems with the program not continuing to run then you need to rethink how you have written your program.

Not sure how to do it in Java but it should be similar to C.

pixelbaker
Feb 20, 2008, 07:38 PM
:( my problem is that I don't know how to execute it it the Terminal. and I would like to be able to somehow compile and execute in the terminal with a keyboard shortcut from my text editor eventually.

toddburch
Feb 20, 2008, 07:50 PM
To execute a java app in Terminal, just be sure you are in the folder where the .class file exists, for example, mytest.class, and then type

java mytest

That's pretty much all there is to it, from a basics standpoint.

Todd

toddburch
Feb 20, 2008, 07:51 PM
And, after you type the javac command once, and the java mytest command once, you can use the command stack in Terminal (you can recall previously entered commands) by using the up and down arrow keys.

It's pretty fast.

Todd

Mernak
Feb 20, 2008, 08:01 PM
if you can compile and run it, but don't get an input prompt, it sounds like your reader is messed up, here is my example code to do thatBufferedReader in = new BufferedReader( new InputStreamReader(System.in) );
System.out.printf("Enter some text: ");
String message = in.readLine();
and just use the normal javac and java to compile and run the program from the terminal.

P.S. JJEdit (http://homepage.mac.com/jmacmullin/) looks perfect for what you are doing.
P.P.S. it seems to have the same bug that netBeans has when requesting info, doesn't display the text of what you should input first, plus various other annoyances.

jeremy.king
Feb 21, 2008, 10:52 AM
:( my problem is that I don't know how to execute it it the Terminal. and I would like to be able to somehow compile and execute in the terminal with a keyboard shortcut from my text editor eventually.

http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/compile.html

Also a really basic IDE is Netbeans BlueJ Edition (http://edu.netbeans.org/bluej/)