PDA

View Full Version : Best Java editor???




jcgnu
Apr 5, 2008, 10:10 PM
Hello everyone.

I've been a Windows user for like ages... I recently switched to Mac and I have a little problem over here that I hope someone will be so kind to help me out with.

Lately, I've been using Netbeans for Java development. It works great, although everytime I want to create a java file, I need to create a whole project thing. It is sometimes useful to create a project, but sometimes I just want to create a single file and compile it (and run it, of course) and that's something you CAN'T do with Netbeans.

Back in Windows, I used a program called JCreator, which is free, to do this kind of stuff, and only when I wanted to create a whole project I used Netbeans.

Problem is, there's no Mac version of JCreator. Does anyone know a program that'll let me do that? I mean, to create, edit (with colors and stuff), compile and run Java programs... The more similar it is to JCreator the better... I hope it's free, as well...

Anyway, thanks for the help.

JC



Heath
Apr 5, 2008, 10:18 PM
JEdit, Textwrangler, to name a couple.
I use textwrangler on OS X and JEdit everywhere else.

stevento
Apr 5, 2008, 10:37 PM
eclipse

RaceTripper
Apr 5, 2008, 10:44 PM
eclipseSee the OP. Eclipse has the same problem that Netbeans does. It's project based. You can't just create a single Java source file to compile and run. I use eclipse too, but it's not the answer to the OP.

I use TextMate when I want to create a quick and dirty Java program to run.

jcgnu
Apr 5, 2008, 10:49 PM
Thanks a lot for your responses.

Out of the three suggested apps (except Eclipse), I liked TextWrangler a little better.

Now my problem is I don't really know how to do anything with it LOL.

1. How can I compile a program without running it??

2. I try to run a program and I get a message saying "This file doesn’t appear to contain a valid ‘shebang’ line (application error code: 13304)".

Thanks for the help!

RaceTripper
Apr 5, 2008, 11:05 PM
Thanks a lot for your responses.

Out of the three suggested apps (except Eclipse), I liked TextWrangler a little better.

Now my problem is I don't really know how to do anything with it LOL.

1. How can I compile a program without running it??

2. I try to run a program and I get a message saying "This file doesn’t appear to contain a valid ‘shebang’ line (application error code: 13304)".

Thanks for the help!

To compile:
javac <java source filename>
To run:
java <name of java class with main method>

You cannot run a java program without compiling it first. The above commands are what you would use in a shell. How you do it within an editor depends on the editor.

jcgnu
Apr 5, 2008, 11:12 PM
To compile:
javac <java source filename>
To run:
java <name of java class with main method>

You cannot run a java program without compiling it first. The above commands are what you would use in a shell. How you do it within an editor depends on the editor.

Well, that's obvious dude...

I want to know how to do it within TextWrangler... and how to COMPILE without RUNNING, not all the way around (which is of course impossible)

RaceTripper
Apr 5, 2008, 11:25 PM
Well, that's obvious dude...

No reason to get rude about it. You didn't say what your Java experience is.

jcgnu
Apr 6, 2008, 12:26 AM
No reason to get rude about it. You didn't say what your Java experience is. Forget I tried to help.

Unsubscribing...


Rude?? I wasn't trying to be rude, I'm sorry...

The problem is, you misread the thread. I was just stating that compiling is obviously necessary for running... And that I wanted to know how to compile and run within TextWrangler, which was stated in my previous post.

Anyway, thanks for the help, and you shouldn't be getting angry... That wasn't my purpose.

Cromulent
Apr 6, 2008, 04:51 AM
Rude?? I wasn't trying to be rude, I'm sorry...

The problem is, you misread the thread. I was just stating that compiling is obviously necessary for running... And that I wanted to know how to compile and run within TextWrangler, which was stated in my previous post.

Anyway, thanks for the help, and you shouldn't be getting angry... That wasn't my purpose.

You can't. Textwrangler is just a text editor. It has no built in function for compiling etc.

You would need to use the Terminal. Although you could write a shell script or an Applescript to do it automatically I think.

jcgnu
Apr 6, 2008, 11:20 AM
You can't. Textwrangler is just a text editor. It has no built in function for compiling etc.

You would need to use the Terminal. Although you could write a shell script or an Applescript to do it automatically I think.

Ohh, OK, that's too bad... Anyway, do you know any other program that'll do the trick?? Compiling and running within it?? Perhaps JEdit???

Thanks!

numero
Apr 6, 2008, 05:39 PM
I'm a little confused. It seems like you want the features of an IDE (edit, compile and run), but you don't want to create a project. I wish I could run JCreator to see what it is that you are looking for.

My best suggestion for a light weight project is to use Xcode. Create a java project and then select "java tool" as the specific type. That will give you one .java file that will run "hello world" by typing command-r. This is what I did when I was in school.

It sounds to me that you are just wanting to try quick ideas. If you really hate creating projects that much you can even keep this one project around and just change your .java file every time you are trying out a new idea.

Xcode fits your price too -- free. Look on your OS installation DVD or get it from Apple's web site.

Hope this helps.

RaceTripper
Apr 6, 2008, 07:13 PM
I'm a little confused. It seems like you want the features of an IDE (edit, compile and run), but you don't want to create a project. I wish I could run JCreator to see what it is that you are looking for.That's not an unusual feature. On the Mac TextMate has it (or you can run an Ant target). I'll bet BBEdit has it too. On Windows a lot of editors offer a quick compile and run: Textpad, JEdit (can use on Mac too), UltraEdit, etc.

I usually just use whatever text editor is handy, and compile/run from a bash shell if it's just a quick and dirty single Java class with no package or dependencies. But I also use Eclipse's "Scrapbook Page" for running snippets of code to test/try things.

But if I already have a project, I like to create a class with some code and create a JUnit test to execute it. That way, if it's something I keep and use, I already have a unit test for it.

myawn
Apr 6, 2008, 07:34 PM
You don't have to create a separate project for every simple little program or code snippet you want to create. You can just create one project -- and call it something like "Non-Project files". Eclipse has to have a project because you need some place to specify what version of the JRE to use, as well as other libraries, and you need to map where the files are going to be in the file system. That's really all the project is.

Then you might try creating a scrapbook page (File / New / Other, then navigate into the Java Run/Debug section and select Scrapbook page. In a scrapbook page, you can just type Java text and then execute it.

For example, I could enter

System.out.println("Hello, World");

select that line, and then right-click and select execute (or just choose Command-U), and you can execute the code right there -- no need for a class file, main method, etc, you can just write and execute as much or as little Java code as you need.

jcgnu
Apr 8, 2008, 12:10 AM
That's not an unusual feature. On the Mac TextMate has it (or you can run an Ant target). I'll bet BBEdit has it too. On Windows a lot of editors offer a quick compile and run: Textpad, JEdit (can use on Mac too), UltraEdit, etc.

I usually just use whatever text editor is handy, and compile/run from a bash shell if it's just a quick and dirty single Java class with no package or dependencies. But I also use Eclipse's "Scrapbook Page" for running snippets of code to test/try things.

But if I already have a project, I like to create a class with some code and create a JUnit test to execute it. That way, if it's something I keep and use, I already have a unit test for it.


Thanks for the help.

Actually TextMate is very close to what I was looking for. Two problems, though:

1) Is there any way to just compile? I mean, instead of compiling AND running, sometimes I just want to compile. Is that possible?? If not, it'll still be OK.

2) It's not free, but I'll think about paying for it, because it IS a lot like what I was looking for.



Thank you all for helping me out!

RaceTripper
Apr 8, 2008, 06:11 AM
Thanks for the help.

Actually TextMate is very close to what I was looking for. Two problems, though:

1) Is there any way to just compile? I mean, instead of compiling AND running, sometimes I just want to compile. Is that possible?? If not, it'll still be OK.I haven't tried this myself, but it should work. Add a command to the Java bundle. Copy and paste the compile part of the Compile&Run command.

jeremy.king
Apr 8, 2008, 10:31 AM
You don't have to create a separate project for every simple little program or code snippet you want to create. You can just create one project -- and call it something like "Non-Project files". Eclipse has to have a project because you need some place to specify what version of the JRE to use, as well as other libraries, and you need to map where the files are going to be in the file system. That's really all the project is.

Then you might try creating a scrapbook page (File / New / Other, then navigate into the Java Run/Debug section and select Scrapbook page. In a scrapbook page, you can just type Java text and then execute it.

For example, I could enter

System.out.println("Hello, World");

select that line, and then right-click and select execute (or just choose Command-U), and you can execute the code right there -- no need for a class file, main method, etc, you can just write and execute as much or as little Java code as you need.


I completely agree. Wanting to use a text editor with some CL integration hackery seems so 1999...

I create a project in all my IDEs called Sandbox - inside that project you will find all my little single class programs that I write and run...

If you find an IDE overwhelming, give Netbeans BlueJ (http://edu.netbeans.org/bluej/) a try.

Edit: JCreator seems a whole lot like Eclipse to me...

jcgnu
Apr 8, 2008, 08:00 PM
Well, I don't have a problem with complex IDE's such as Netbeans or Eclipse... I use Netbeans A LOT... Never used Eclipse, but I love Netbeans!! Except for one little detail:

Sometimes I just want to write a program (probably not small nor simple) which I don't want to be part of a project. For example, I do a lot of programming in JSP. Everytime I create a servlet, I don't want it to be in a project and having to take it out of there everytime I make a new version.

The problem is, Netbeans doesn't allow you to do that. Either you create a Netbeans project, or you just don't use it! (or just compile it outside of it).

That sucks... That's what I like about JCreator in Windows. It allows me to create, edit, compile and run Java files without having to add them to a project.

Having both options is great, so I decide when I use each.



Edit: JCreator seems a whole lot like Eclipse to me...

JCreator is a lot different than Eclipse, especially because of what I stated before...



Thanks for your comments.

stathis.z
Jul 27, 2010, 07:56 PM
From what I understood from your posts, all you need is a lightweight program to just write, compile and/or test code.

There is a freeware application called BlueJ, developed by Kent University as a java learning tool, that i think it actually fits those needs perfectly. It also has good step by step debugging capabilities, javadoc generation function and it can compile your code without you ever having to run it. Interface is quite simple and the program is really easy and fast to use.

Here's the link, i think you should try it out.
http://www.bluej.org/download/download.html

phatqao
Jul 27, 2010, 11:47 PM
for a simple color-coded text editor, try smultron

mrbash
Jul 28, 2010, 09:39 PM
I know exactly what you mean. Sometimes I just want to write a single file to test something out instead of a new project. Unfortunately there isn't much available.

I did a quick search and there is DrJava (http://drjava.org/). It seems pretty straightforward and lets you just write a single file, and compile from inside of the editor.

RossMc
Jul 28, 2010, 10:03 PM
I wish they made a Mac version of Crimson Editor :(

WizCraker
Jul 29, 2010, 01:42 AM
I find that xCode is difficult to use compared to other IDEs, but once you figure it out it kind of grows on you.

When I was learning Java I used xCode after getting comfortable with its way of doing things, but I also used TextMate (http://macromates.com/) religiously. You can compile and run the single or project Java from within TextMate.

RaceTripper
Jul 29, 2010, 08:00 AM
I know exactly what you mean. Sometimes I just want to write a single file to test something out instead of a new project. Unfortunately there isn't much available.

I use TextMate for that. I can edit, compile and run a single Java source file from the editor very easily.

rdyornot
Jul 29, 2010, 08:04 PM
FYI: I use Netbeans, and you can make executable files without making a new project each time. Just make one project, then within that project you can make as many executables as you like. Just compile and run whatever you need individually and it works just fine.

tinaCEO
Jul 31, 2010, 04:11 AM
Search on google you ll get many free java editor. But i recommend you net beans is best to use.

macsmurf
Jul 31, 2010, 05:24 AM
Sometimes I just want to write a program (probably not small nor simple) which I don't want to be part of a project. For example, I do a lot of programming in JSP. Everytime I create a servlet, I don't want it to be in a project and having to take it out of there everytime I make a new version.

Could you explain this in a bit more detail? I don't understand why servlet code needs to be outside a project. I always put it inside a project. If I want to keep the model code separate, i create a core project and a web project, where the web project depends on the core project.

RaceTripper
Jul 31, 2010, 12:52 PM
I thought I would add that I've taken to using GroovyConsole for trying out snippets of code. Instead of defining a java class with a main method in a source file that needs to be compiled and run, I just type the code snippet I want to try in the GroovyConsole and execute it. No need for a class or even method definition. Very handy.

yorchpac
May 28, 2011, 02:56 AM
Thanks for the help.

Actually TextMate is very close to what I was looking for. Two problems, though:

1) Is there any way to just compile? I mean, instead of compiling AND running, sometimes I just want to compile. Is that possible?? If not, it'll still be OK.

2) It's not free, but I'll think about paying for it, because it IS a lot like what I was looking for.



Thank you all for helping me out!

Have you tried drJava .... it worked for me on Windows... and is available on Mac ...