Best Java editor???

Discussion in 'Mac Programming' started by jcgnu, Apr 5, 2008.

  1. macrumors regular

    Joined:
    Dec 30, 2006
    #1
    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
     
  2. macrumors regular

    Joined:
    Aug 19, 2005
    Location:
    Canada
    #2
    JEdit, Textwrangler, to name a couple.
    I use textwrangler on OS X and JEdit everywhere else.
     
  3. macrumors 6502

    stevento

    Joined:
    Dec 10, 2006
    Location:
    Los Angeles
    #3
    eclipse
     
  4. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #4
    See 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.
     
  5. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #5
    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!
     
  6. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #6
    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.
     
  7. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #7
    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)
     
  8. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #8
    No reason to get rude about it. You didn't say what your Java experience is.
     
  9. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #9

    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.
     
  10. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #10
    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.
     
  11. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #11
    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!
     
  12. macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #12
    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.
     
  13. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #13
    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.
     
  14. macrumors member

    myawn

    Joined:
    Nov 9, 2006
    Location:
    Marietta, GA
    #14
    I still say Eclipse . . .

    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.
     
  15. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #15

    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!
     
  16. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #16
    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.
     
  17. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #17

    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 a try.

    Edit: JCreator seems a whole lot like Eclipse to me...
     
  18. thread starter macrumors regular

    Joined:
    Dec 30, 2006
    #18
    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.


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



    Thanks for your comments.
     
  19. macrumors newbie

    Joined:
    Jul 27, 2010
    #19
    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
     
  20. macrumors member

    phatqao

    Joined:
    Jul 20, 2010
    Location:
    PA and/or NYC
    #20
    for a simple color-coded text editor, try smultron
     
  21. macrumors 6502

    Joined:
    Aug 10, 2008
    #21
    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. It seems pretty straightforward and lets you just write a single file, and compile from inside of the editor.
     
  22. macrumors 65816

    RossMc

    Joined:
    Apr 30, 2010
    Location:
    Newcastle, UK
    #22
    I wish they made a Mac version of Crimson Editor :(
     
  23. macrumors newbie

    Joined:
    Jul 28, 2010
    #23
    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 religiously. You can compile and run the single or project Java from within TextMate.
     
  24. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #24
    I use TextMate for that. I can edit, compile and run a single Java source file from the editor very easily.
     
  25. macrumors newbie

    Joined:
    Sep 15, 2007
    #25
    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.
     

Share This Page