i use eclipse for java programming. but often i feel very necessary to just make one/more independent java class file for certain minor testing purpose.
I used JCreator 4.5 in my graduation under institute license but since i want it in my home i am looking for an open source equivalent.
I tried my best in exploring in eclipse but it mandates project name. now it not always possible 2 make new projects for every different testing, but it is very possible to make different independent class files and save them in my folder n review them quickly when needed.
So i have looked out for JEdit, Intelli J, Dr Java but none of them can provide me the facility that JCreator does basically listing- Auto Suggest after '.'(dot), auto indentation, easy modular compilation and execution, error or failure details, different terminals for different running-program instances and better drop down suggestion for every component exposing available java methods in built functionality , etc.
So guys need your help n suggestions n experience in dis matter, do correct me if these are possible eclipse also.
Actually, being forced to make a project is a good thing - in real work Java programming developers rarely create standalone classes. Perhaps you should look into using Maven for building Java applications, that will help you develop some better practices as far as arranging your sources and building only one artifact at a time.
If you really want to create simple classes to test things out, why not create a single project in Eclipse for that purpose? I often do that, adding various classes to that project. Then you can right-click the class and run it.
Thank you guys for your reply but as I said i am already using the methods as you guys have suggested but it is not efficient every time.
As some one mentioned that it is always advisable to use different project for different test module, we cant do it every time. Suppose if I wanna show my students how a certain block of codes for IO/ servlet works then for every minor demonstration(such that every module are slightly different) or in other case will force me to make new projects. This is very cumbersome as I am following this trend. This happens easily in JCreator.
But basically what I am sensing is that it will be hard to find such JCreator functionality.
tarun saha wrote:I wanna show my students how a certain block of codes for IO/ servlet works then for every minor demonstration(such that every module are slightly different) or in other case will force me to make new projects.
No, it doesn't; I and another person specifically said make a single project that has a lot of tests/examples in it. For example, I have an Eclipse (and IntelliJ, but that doesn't matter) project with most of the code samples I post here on JavaRanch.
Joined: Mar 23, 2010
Yes David it can be done but then how can I show a project without any static main or in some cases with multiple main functions to let understand the flow of commands?
Eclipse does not allow this.
tarun saha wrote:In eclipse, making a new file/ class file asks for source folder name which in turn needs project name which is discouraging me
Oh come on, it is not that hard! Try this:
1) Create a new project of type "Java Project"
2) Expand the newly created project (in Project Explorer) so that you can see the source directory (mine is listed as "src/main/java" but that is because i modified the dfault structure to match Maven's structure, I think that yours will be just "src" and it should be marked with the source directory icon)
3) For each new class you want to create, right-click on the source directory and select New | Class and fill in the New Java Class form. All you really need is the Package name (optional, really but recommended) and class Name.
4 ) The editor opens up with the class skeleton, fill it to your heart's content.
5) To run, right-click the xxx.java file in the Project Explorer and select Run As | Java Application
For each new class, repeat steps 3 through 5.
Joined: Mar 23, 2010
yes i know but in that case you cannot make multiple static main functions. Still as you said it is applicable so I will continue in this same technique.
tarun saha wrote:but in that case you cannot make multiple static main functions.
Do you mean in a single class? Of course you cannot do this.
Or multiple classes, each with its own static main? Yes you can do this. That is the whole reason why I wrote up step 5 the way I did - by right-clicking the specific Java source file you want to run, that is the one whose static main is used.