Choosing a Java IDE for homework assignments [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Can anyone recommend a light Java IDE that doesn't require you to make new projects each time you want to compile and run a program? I just want to be able to open java files and compile and run them. I have already tried Eclipse and NetBeans but both require you to make a new project each time you want to compile and run a program. Making a new project is fine for large scale projects but for small school assignments this just makes the process more tedious.

I've been doing java school assignments using Eclipse. I had one project called "Homework", and created a new package for each assignment. That worked fine for me.
Update: in addition to the practice suggested above, it seems eclipse has a subproject (still in incubation, though) called ide4edu that is specifically for educational purposes.
The Eclipse IDE for Education is a version of Eclipse streamlined specifically for use by university and college students.

In Eclipse, you can just paste code into the package explorer without a given project, and a new project is created containing a file with that code, inside a main method. If the text you paste is a full class, it will name the file according to the class name. You could also set up a single project for your stuff and paste the code or the files you want to run into that project.

I've used Notepad++ to do this for simple Java projects and it worked quite well. Here is a guide on how to do this.
You may also want to check out jEdit, I believe it offers similar functionality, and may be more feature-rich for Java than Notepad++ is.

My school uses DrJava for the first intro to programming class. Its a lightweight IDE and allows you to create folders on the fly for your java classes.
However, my classes now require Eclipse or Netbeans, and it did take some getting used to them. In some places, Eclipse is overkill for a second-year CS student, but I do like its features & am having fun exploring the extensability with other languages.

It might sound geeky or "not for novices" but in order to compile and run a single file the best option(in my opinion) is a console environment.And of course you can view them from notepad++ or any editor with similar fetures(especially highlighting).

How about using a editor like Vim, or Emacs and then install some plugins so that you can have basic IDE features like code completion, etc? You will need to do bit of monkeying to get the right kind of combination and comfort. But, it could well be your answer for a lightweight IDE, one that does not require you to create a project.

NetBeans can have an arbitrary number of classes with main() methods. Create a project named school using NetBeans and create a new package for each group of related assignments. Customize the default configuration menu to make F6 run your current main(). At the same time, develop your skill with bash and a favorite command line editor.

Some universities (like mine) use
BlueJ
for Java Teaching. It basically got everything you need for your homework assignments, and it got NO code completion, which I find perfect for Java beginners ^^.

What's wrong with creating project? Just create it ones and then use it for all your assignments. That will let you use any good IDE (NetBeans, Eclipse, Intellij Idea, ...) which, from other side, greately simplifies writing java code.

I recommend bash. I write a lot of test programs for work (and for the likes of answering stackoverflow questions). javac MyMain.java && java MyMain and you are done.
I have done one project and many unrelated packages, but that sucks. It also cannot cope with more complicated build cases (when dealing with, for instance, serialisation or class loaders).

Personally I enjoy using Emacs for editing my code than then Ant to build / compile my Java code.
Bare in mind that using a lightweight editor will generally mean loosing out on some very useful features, for example:
Auto completion. So for example in Eclipse if you start typing System.out. you can a list of options to complete the statement along with which parameters the function will require
Mistake highlighting : nice "red swiggly lines" highlighting simple mistakes
Build path management : adding external archives is trivial in eclipse less so from the command line for those with little experience
Amongst many others.
Personally I'd way up whether the "faff" of setting up a new project for a simple Java application is worth loosing those really useful features. And that usually varies per task.

I recommend jGRASP. It's a (very) lightweight Java editor, good for the beginning programmer. You can literally paste in some code, compile and save, and your program is ready to be run.

You need a well defined classpath before you can just compile you classes, and that's exactly what the project setup is for.
Just create a project once and forget about it - use it for all your stuff.

you can use cedit. which is not exactly a IDE but you can have compiler and JVM tools attatched to it and you can do whatever you have mentioned. i mean creating a small java file compile and run.
you can that here http://mac.softpedia.com/get/Word-Processing/CEdit.shtml

Why don't you create one project and fill it with all the programs you ever write. There is nothing forcing you to create a new project each time. The only reason to have multiple projects is to make managing the programs easier. So if projects don't make your life easier don't create multiple projects.
BTW: I suggest IntelliJ as I believe it is better, but in this case I suggest the problem is how you work and changing IDE won't make much difference.

This sounds redundant, but the posters are right. However, you know what you can run. If you don't have the resources and you need to run a webserver, putty, etc.. notepad ++ would work (light enough). If your desktop is nice and can handle it, use Eclipse (vast adoption). Create a java project and add packages to it (as Kaleb, Frank and other suggested).

To use IDE for assignment, my approach is to create a test project and use it each time for different assignments. Because in IDE like Netbeans and Eclipse, each class file can be made executable, thus it is quite convenient acutally.
Also for assignments if you want to have more control over your code, Notepad++ is very good for writing codes. You can add in features such as Compile and Run using macros in Notepad and make shortcut key for it.
VIM and Emacs can also be good choices as my friend often talk with me about them. Well i am not quite familiar, you can try it.

Related

Java Development Workflow with Text-Editor and Commandline

I want to get started with Java! I have a bit of experience with C/C++ and Python development. For this i'm mainly using Emacs (a text editor) and the commandline, thus not using a heavier weight IDE for those kind of things.
I don't want to adapt my workflow to suit an IDE, but I don't know the Workflow (write, build, test) in Java so I thought about asking here. Searching the Web didn't give me good results.
Can someone give me the the basic workflow when developing Java with my requirements? I use Linux for all my programming.
Are my requirements/wishes even practical or should i consider using something like IDEA or Eclipse?
Can someone point me to documentation or blog posts about this topic or documents, that give a quick overview and/or examples on how to get started with Java (something for programmers with a little experience in other languages)?
For this I'm mainly using Emacs (a text editor) and the commandline,
thus not using a heavier weight IDE for those kind of things.
An IDE has many advantages over a text editor, mainly when navigating, debugging and refactoring code, but it is not required. Actually, working without an IDE is useful to understand the underlying technologies. My advice would be: Start without an IDE, and when everything works, try out some IDEs to see how they help you.
Can someone give me the the basic workflow when developing Java with
my requirements?
The basic workflow is (for any compiled language):
write source code
build
run
In the case of Java, that means:
1 Writing source code
You write .java files in a text editor, observing the right filesystem layout (file name = class name, directory corresponds to package etc.). You already have that covered.
2 Compiling the code
You compile the code using a Java compiler, possibly building a JAR or WAR file (depending on the type of application you are writing). You can do that manually by directly invoking javac (see for example Java - compile from command line - external jar ), but you should really use a build tool. The best tool to get started is probably Apache Maven or Gradle.
The basic idea is the same with both Maven and Gradle: You write a build file, which essentially describes your project and how to compile it (a POM file in the case of Maven, a build.xml for Gradle), then you can build by just invoking the build tool. The build tool takes care of all the nitty gritty like invoking javac etc. Most importantly, both also perform dependency resolution, meaning they can automatically download and use libraries that you use in your code.
3 Running
Finally, you run the program from the command line. How to do that depends on the type of program: A simple executable (or a Spring Boot application) can by run using java -jar myprog.jar, a WAR file must be deployed to a Servlet container (such as Apache Tomcat).
I hope this gives a general overview of How do I develop without an IDE?. For more details, look for specific questions here on Stackoverflow (or elsewhere), read the docs, and if all fails ask a more specific question here :-).
I agree with #sleske : if you really want to learn the language, it's good to start with a text editor. Later on you can use an IDE but by then you will know how the build process works and what exactly the IDE is doing. There exists no magic in coding. If something works but you don't understand why, it will certainly fail one day :)
Maybe some nice feature: I use Eclipse and added a vim plugin :)
And if you learn some useful shortcuts you can write code really fast (without a mouse)
You should download IntelliJ directly:
certain best practices like static import make your code more readable because you read it with a smart IDE. If you read code just with vim, the navigation between classes is not possible.
you have an easy access to a terminal and perform certain Maven or Gradle commands here.
I would not say the same with other languages (css, html).

How to implement a java IDE with Java

I would know how to implement a Java IDE using Java language.
My IDE should :
compile, run and debug a source code.
import or export file from a directory.
allow generating code from class diagram.
allow modifying Java text editor.
allow generate Swing source code from, I mean it will offer a ability of drag and drop, then it generates source code.
it gives possibility to save, delete, undo and redo.
it support JUnit, maven and Ant.
So, I ask about technologies that will help me to realize this Java IDE. How to implement this IDE?
Except for the "drug" part which I am not sure of, I can tell it is not a trivial amount of work and of course I'd use the Java's GUI API
http://en.wikipedia.org/wiki/Swing_%28Java%29
Will not be sarcastic like others around here so I will try to give a short answer.
Despite there are some very very mature Java IDE's (Eclipse,NetBeans,INtelliJ ,JCreator,Codeguide etc) around it is your right to do another (who know someday maybe better then existing ones).
This being said you can do it
Swing (here you have to start from
zero)
use RCP Eclipse
Netbeans platform
QT it might be a solution
etc.
All of this support drag and drop and have support for creting class diagrams...
I warn you it is not easy....not easy at all.
Eclipse was audited recently and it has apx. 46 millions line of code
Good luck !
I'd safe yourself loads of time and just use Netbeans out of the box. Does everything you've listed and more. It's also free and has a module architecture to allow new functionality to be added fairly easily.

Can I develop for Greenfoot using Intellij Idea?

I'm taking a Java course where I have to do some development for Greenfoot. I'm very accustomed to using vim for development in C / C++ and so have been using Intellij Idea with a vim plugin.
I despise the Greenfoot IDE.
Is it possible to use Intellij to develop for Greenfoot?
As you've found already you can add libraries and mess around to get some bits working, but it's not officially supported (so might change from release to release or break) and most likely never will be. It's more by accident than design that it works at all this way.
I've often wanted to use a professional IDE for doing Greenfoot work myself, but the simple answer is that Greenfoot is primarily focused for beginners, for a fun and interactive way of teaching Java to people who have never programmed previously. The developers could potentially focus their time in providing official support for coding in other IDE's, but the amount of work required means it's pretty much been decided it's not worth doing.
If you haven't noticed already, Greenfoot 2 is now out with a much improved editor that supports basic code completion and intelli-sense. It's still of course nowhere near the IntelliJ editor, nor will it ever be, but it certainly makes developing in it more tolerable if you're used to something more advanced.
I use IntelliJ and I do not think it would be supported, but I am not certain.
This site has a similar question
I was able to go into the Project Structure, dependencies tab, select add module library and do attach classes selecting the /lib/greenfoot/standalone directory. This allows me to compile the balloons scenario cleanly. However, to actually run the scenario's you still have to use the Greenfoot environment due to all the games it plays behind the scenes.
This link is about Greenfoot in Eclipse, but the steps also seem to work with IntelliJ.
Basically you add bluejcore.jar and greenfoot.jar (found in your installation directory of Greenfoot) as your project libraries and create a properties file (details in the link) for Greenfoot. Finally select GreenfootScenarioMain as main class, this allows you to launch Greenfoot programs from within IntelliJ.

What are some good plugins for developing Java in VIM?

I love vim, but not having things like IntelliSense/Code completion from Eclipse makes it pretty difficult. I know, I know, I should be able to look at method signatures and java docs for the API I am interested in using. I'd love to, but I'd like it to be accessible from my fingertips instead of having to browse the source tree manually or have a JDK reference handy.
What plugins would make this easier?
I tried eclim for a while. It was pretty good, basically it uses eclipse in the background as a kind of engine and provides a plugin to let you use all of eclipses goodness through vim.
http://eclim.org/
Don't write Java in Vim — put Vim inside a Java IDE:
IdeaVIM for IntelliJ
viPlugin or Eclim for Eclipse
jVi or ViEx for NetBeans
I love Vim, but using an IDE for Java is the only way to stay sane. A decent Java IDE will:
Show invalid syntax or type errors
Show missing JavaDoc
Manage import statements for you
Highlight unused methods and variables
Safely perform powerful refactorings such as moving methods or renaming classes -- (no, search and replace doesn't cut it, I promise)
Reformat your code automatically or on-demand
Vim can't do the above, but you can use all the Vim keybindings in a program which does.
I use Eclipse + Vrapper. Enables the vi dual mode editing we all know and love. <ESC>
Completely free and lightweight. The goal is to have the comfort and ease which comes with the different modes, complex commands and count/operator/motion combinations which are the key features behind editing with Vim, while preserving the powerful features of the different Eclipse text editors, like code generation and refactoring.
While eclim is another alternative, I feel eclim takes over Eclipse and vrapper doesn't.
Check out the JDE plugin for Vim. It provides Java omni-completion and a documentation viewer (among other things).
I use the javacomplete.vim plugin for omni-completion for java. It's a very nice script: it also shows the method signatures on top of the omni-completion. The downside is that it is a bit slow, but it has worked fine for me otherwise. Eclim might be better ut I haven't tried it yet so I can't comment on it.
I've also used the jcommenter.vim plugin for generating javadoc comments. It can parse method signatures and automatically add the relevant #param foo fields and such.
For the API searching I would suggest on overriding the K key on normal mode. It searches man pages for the keyword under the cursor, but the behavior can be overriden by setting the keywordprg variable. See this thread for an example.
Other scripts which I've found very useful (not specific to Java development): NERDCommenter, AutoClose, snipMate, Align.
There's an IntelliJ VIM plugin as well. Plus, IntelliJ is released an open-source, free version.
Vim is not an IDE replacement. But very specific additional tool. With Vim you should only do small-fast tweaks while the main development is going under Netbeans/Eclipse/IDEA.
One more time. It is a Bad Bad Bad idea to turn Vim into Full IDE. Why? It won't be so fast. And thus won't be so pretty.
Here is scenario. You have opened Eclipse or whatever to edit your current task. And in 10 minutes you have to switch to another Task which is kind of urgent. The task is to tweak a little a maven or an ant built script and/or some deployment perl/python/groovy scripts.
How much time will it take to reload Eclipse to work on a new 5 minutes task and switch back?
But if you are Vim guru you can handle this in seconds. You can change one file and run Ant/Mvn within Vim.
And this is the power of Vim. You can change and check one file in no time no matter which extension it has: java, groovy, c++, makefile, bash, c#, etc.
This will be an uphill battle. There is so much knowledge about your program built into Eclipse, that I expect you will eventually have to reimplement it all to be happy.
Any particular reason you cannot just decide you like the built-in editor in Eclipse?

Good Java Practices in Ubuntu

Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser.
I've considered Eclipse, but it seems to bloated and unfriendly for quick programs.
Java editing tends to go one of two ways; people either stick with a simple editor and use a terminal to compile/run their programs, or they use a big IDE with a zillion features.
I usually go the simple route and just use a plain text editor and terminal, but there's still a lot to be said for IDEs. This is especially true when learning the language, since hitting "spam." brings up a dropdown with all of the fields and methods of the spam object. And this is not just useful to a beginner; it remains useful later on when using unfamiliar libraries and third party modules.
IDEs also have useful tools such as GUI builders which become invaluable when doing professional Java work. So although I typically prefer a simple editor/terminal combo, I highly recommend trying out an IDE such as Eclipse or Netbeans to see how you like it and so that you'll know how to use one later on.
Eclipse may be bloated for learning needs, but will probably give you the best overall Java experience. Try working through some of the built-in tutorials if you find the interface confusing.
I too vouch for eclipse (or IDEA if you have the money, actually IDEA is better than eclipse by a small margin).
But, make sure that you know how to compile and debug without an IDE first, and also learn to read the compiler's warning/error messages - they are essential skills for developers that using an IDE can prevent you from learning.
Eclipse and NetBeans are both good options. If you don't mind paying a little, so is IntelliJ IDEA (an academic license costs $99).
As far as IDEs go, I've found Eclipse to be about the best you could ask for. If you are used to IDEs full of features like VS, it should be right up your alley, and it isn't particularly resource-hungry; the way it organizes your projects makes the whole thing pretty simple as well, and it's also good to have on your resume. If you're looking for a non-intrusive IDE, mostly intuitive and that does its job as a great assistant, go with Eclipse. Not to mention its customization options.
If, on the other side, you'd like a much more light IDE, textPad-style (why?), I'd recommend Geany; I've worked with it in the past and it's got all the basic features to get started with the language and not be overwhelmed with all the features that big IDEs can offer. But I'd still recommend to go with Eclipse as soon as you get used to the language and need the IDE to be more of an assistant.
Another vote for Eclipse. In particular, you should be able to install it from within Ubuntu, as there are packages for it in one of the repositories (I forget which one specifically, as I'm not at my Ubuntu machine right this minute). If you use the GUI package-management application under the "Admin" menu, you should be able to find Eclipse and related packages.
I'd actually just recommend Eclipse. It seems bloated at first, but once you get used to it, you can use it to develop code very very quickly (and thus it's an excellent choice for a quick bit of Java).
Features I like:
Control+1 for error fixing - it knows how to fix most compile errors - just highlight the error in the code (which will be underlined in red) and it will give you a list of suggestions. Control+1 selects the first suggestion, which is almost always correct.
You can use this error fixing feature to write code that uses methods you haven't written yet - the error fixing will create the method on the class/interface you called it on, with the correct parameters/name/visibility etc. Or, if theres a similarly named method with similar parameters, it will suggest you've spelt it wrong when you called it.
The refactoring tools are also supergreat - you can highlight a block of code to extract as a method, and it'll work out what variables need to be passed in, and what it should return (if anything). You can move variables between field and methods. You can change class/interface/variable names, and it will correct them only where it needs to (which beats a search and replace any day).
You really don't need to know many eclipse features to get the benefit of using it - and it'll dramatically speed up your coding. I wish I'd known how to use it at University.
Basically, I'd recommend Eclipse. The time saved coding will make up for having to click "yes" a couple times when you start a project..
I'm using NetBeans with success right now.
I usually just use vim, but i've actually found the IDE Geany quite intuitive with a lot of good features but not really overblown. Check it out.
EDIT: I don't think Geany is fit for enterprise-level programming, but for a quick program it's one of the better IDEs I've seen, especially if you've had bad experiences with NetBeans or Eclipse as I have.
As many others, I suggest you to use Eclipse. It works fine in linux and after a few days you will find it not so unfriendly.
Moreover, if you will start developing more complex programs in java, you already will be familiar with a standard, complete and open source IDE, which is also the foundation for many other professional IDE for other languages, like Adobe Flex Builder, Aptana Red Rails and so on.
There is an interactive "IDE" designed especially for learning: BlueJ at http://www.bluej.org/
While I generally agree that Eclipse, NetBeans, or one of the other IDEs can be very helpful, they are pretty heavyweight for a learning environment; and you can end up spending your time wrestling with the IDE instead of learning Java.
In my career I've also found some people that don't really understand what the IDE is doing for them; they are totally lost without it (see Voodoo Programming). I recommend you spend at least some of your time with a simple editor, like gedit or vim, and the command line javac compiler.
BlueJ is considered a good editor for Java, tough mostly aimed at beginners. It does not bloated as Eclipse, but contains many useful features. It is also an open source project, so you are welcome to give it a try.
In our working enviroment we have to use the free Oracle JDeveloper ... sigh .. at home I tend to use Eclipse more and I really like it
Netbeans is a heavy but good IDE. Netbeans always have many features you don't really need, but because it's made with the netbeans platform, you can always strip it down to the essentials !
If you don't like all the work, go with eclipse. It's a lighter IDE.
Geany is pretty handy, don't quite know how it is with programming Java, but with programming C and C++ it's a nice light weight IDE. (BE WARNED: Building big projects usally tend to fail in geany. Workaround: compile in Geany build in terminal)
Bryan

Categories

Resources