I thought I sent this yesterday, but I don't see it. This is a tutorial by Jim Corbett. I am placing it under my name. If due to the length it does not go through I will send it to anyone individually. This way I can lighted Jim Corbett's time spent for us. Let me know at susan.stanzel@xxxxxxxxxxxx if you don't get this. Susie +++ Creating Eclipse IDE's Workspace. Essentially you can place all of your projects into a neat self contained working area known as the Work Space. Essentially what you have is a folder structure such as C:\Work Space. Now we need to be able to set up the ws in the first place: If your Eclipse is at the root of C:; open the file at c:\Eclipse\Configuration\.settings\org.eclipse.ui.ide.prefs If you right click the file and select the option Open With. locate Notepad and check the control that asks if you want to open this file next time with Notepad. Essentially what you have opened is a text file. Locate the entry "SHOW_WORKSPACE_SELECTION_DIALOG=false", change the false to true and resave the file. Next reopen the Eclipse editor. Note you will be prompted to select a Work Space. You can either brows for the Ws or manually enter it. Do not select the option to use the Work Space as the default for all projects. Select OK and there you have your first Work Space. +++ Creating a Project. 1. Load Eclipse and select your work space. 2. From the file menu select the "New" option and then the sub option "Project". 3. You are now placed on the Project Wizard. Tab to the list and select Java Project and then click the Next button. 4. A new screen will appear. tab to the project edit field and enter the name of your project. In this example we will call it first_time. 5. Ensure that the option for creating project in work space has been selected. 6. Ensure that the option for creating new source and output folders is selected. Then tab to the Finish button. You can now view your efforts by using the following key combinations: alt w + v + p + enter. You are now in your own workspace with your project first_time. +++ Creating a Package At this point of the excersise we can think of a package as just a folder. Nothing more, nothing less! It contains files mostly with a .java extension. If we follow the hierarchy that we have been using it might look something like this: C:\work space\first_time\src\my_package. during the last instalment with the wizard, the src folder was created for us. So lets create a package. 1. Open your project explorer. Alt + w + v + p + enter. 2. Expand the tree view so that the src folder is open. 3. Again from the File\New menu option select Package from the sub menu choices. 4. A new screen will appear and you are prompted for a package name. Note, in the java language packages have lower case names and should reflect the purpose of the package. In our example we will use main. +++ Creating a Class A class is a template for an object and objects have attributes and properties. 1. Again, from the File\New\ menu, select Class. 2. A new screen will appear and you are prompted for a name for your class. In the java language all classes start with a capitol letter so in our example we will call it Main. Note the capitol M. 3. Since our example is of a MVC (Multi View Controller we have a start up class Main which will be in the package main with a lower case m. 4. In order to denote this class as our main start up we must first add a few things: 5. Once you have entered the class name, tab until you reach "public static void main (String[] args)" and select the check box. Continue tabbing until you locate the Finish button. 6. If you view your project explorer and note that the class file is not in the main package, you can right click the file, locate Refactor\Move and then move the file into the corresponding package. +++ Hello World So far, we have created the Work Space, a project, a package and a class. However at this point we really can't even run the class with out delving deeper into the IDE. Let's assume that we want to run the project for the first time: 1. Select alt R + R from the main menu (Run\Run Last Launch). 2. Once the new screen appears, tab once to the treeview. Eclipse Project is usually the default selection. 3. Scroll down the treeview to locate Java Application. 4. Hit enter on this selection. the tree will expand and Main will be the child node. 5.Tab once and you here the prompt for name along with Main 5. Tab again to Main Tab. 6. Tab again to hear the Project prompt and you should hear first_time. 7. Tab twice to locate the Main Class. in this case you should hear main.Main. If not, use the brows function. 8. Continue to tab until you locate the Run button. If everything is in order, you really shouldn't hear and or see anything. +++ So far we have created the workspace, the project, a package with in the project titled main (lower case m) created a class with in package main titled Main (upper case M). What we essentially have here is an entry point to the application which can be referred to as a MVC (multi view control). Now we need to run this thing. From the Run menu select "Run Last Launch" or F11. You will now be placed on the Run / Launch Configuration screen.... Tab once to the tree view and scroll down to the option for Java Program. Press "Enter" on this selection, by default you should see Main... Tab once to confirm the name as Main... Tab twice to see the project name... in this case first_time.... Tab twice more to locate the Main Class. Don't get confused with "Main Class" and your class Main. "Main Class" can be assumed to be the entry point of the application and or the start up point. In our case you should see main.Main mix of upper and lower cases. Continue to tab until you locate the "Run" button; press enter and there you go. If you have followed these steps then outwardly you will notice nothing, which is a good thing. +++ We are going to create a simple project based upon the structure we've already created. 1. Let's open the Eclipse IDE and select our work space. 2. Let's open the project explorer. 3. Expand the project "first_time" so that you are with in the src folder. You will notice that we have the lower case "m" main package that we had previously created. remember that this is our package that contains upper case "M" Main.java which is our interface to the world. If you adhere to the MVC structure (Model View Controller) as we are in this project, encapsulation will more or less be assured. Generally speaking, a package is used to contain related code i.e. java files or .property files. So for this example we will create a new package titled "example_one", excluding obviously the quotes. Remember that the package is always lower case. 4. Once the package has been created we need to create the class "HelloWorld". Upon the creation of the class, you will be placed directly with in an editor for the same class. Take a moment and scroll up to the top of the page. Take note that your new class is part of the package "example_one". You should have only really two lines aside from the package line: - The class declaration line ending in a left brace; - The class terminator with the single right brace. Let's add two forward slashes and the text "end of class". The double forward slashes denote the beginning of a single line comment. 5. Move to the top of the page and then to the end of the package example_one; line. 6. Press the enter key twice to give us a blank line and a new line for editing. 7. Type the following: /* and press the enter key again. Here's what you should see: /* * */ This is yet another form of commenting in Java. If you enter text on the line that begins with the single star character and then press the return key, another star will be created on a new line for editing. Here is an example: /* * class for demonstrating java coding techniques. */ Usually but not always, these comments are followed by your "import" statements. What we have now is really just the outline of a class. 8. Between the class declaration line and the terminator line we need to add a constructor method. 9. Type the following: public HelloWorld () { and then hit the return key. You will be placed on a blank line but if you scroll down once you will notice a corresponding right brace to your constructor method declaration left brace. Generally speaking, your constructor must be public for the rest of your application to see it, however we will talk later about a private constructor. The constructor method must always have the same name as the class so in this case the class is named HelloWorld and the constructor is also HelloWorld. Directly following the name is a left and right parentheses. You can pass arguments between them if necessary. Here is an example of that: Public HelloWorld (String myString) { } In this example, I'm passing a parameter of type String and the parameter is titled myString. So, we need to discuss "public verses private". Well it is what it is. Public can be seen by all and private can't. However it goes much deeper than that. If you remember that in our Main.class, its declaration was public so as the world could see it. But if we wanted to see the HelloWorld.class we would need to create a private instance of it. Now hopefully you are wondering how this can be, since HelloWorld is declared public! Yes the class HelloWorld is public to the project but when creating an instance of the HelloWorld object it becomes private so that it remains hidden to the world. So, the rule is at least for this example a public class becomes private when you create the object of that class. The rules of encapsulation are not broken and Newtonian Physics keeps those dam apples falling on our heads. as you seen with the constructor example above, it's public. However with in the class you also can have private members, private and public methods, all which can maintain the rules of encapsulation eg. Private String myName = "Jimi"; public void setMyName(String name) { myName = name; } Public String getMyName() { Return myName; } Above are examples of how private and public members and methods interact with in your public class which can be a private object. Here is a fully built class demonstrating what I've been rattling on about: package example_one; /* * class hello world * * written by j. Corbett * * Nov. 25, 2008 * */ public class HelloWorld { private String hw = "Hello World"; public HelloWorld() { } public void setHelloWorld(String s) { hw = s; } public String getHelloWorld() { return hw; } } // end of class +++ We are going to create an object. 1. Let's open the project explorer. 2. Expand the tree and locate then open the Main.java file. 3. Add a couple of blank lines below the "package main;" line. 4. Add some comments either with the double slashes or the /* as in the previous tutorial. We need to discuss importing at this point.... Regardless of whether the class you are importing is in the same package or other packages or even other .jar files none of these classes are self aware of the existence of other classes. A package can be directly part of your project much in the way we have been discussing it. It also can be an external .jar file which may contain many packages. Some of these .jar files are known to your IDE such as the Java classes and yet others have to be manually added as reference packages to the project. Here are several examples: A. import example_one.HelloWorld; B. import java.io.*; C. import org.eclipse.swt.widgets.MessageBox; In the first example, we are directly specifying our package "example_one" and the class "Hello World". Example 2 imports from the java package, the io package and all packages and or classes below io. In the third example we stretch the import out burrowing down through a number of packages to get at the MessageBox class. you can actually with in your methods explicitly declare the class like this: Private example_one.HelloWorld hw = null; Or Example_one.HelloWorld hw = new example.HelloWorld(); These are all valid statements and each is useful in there own right. So for our particular example we are going to import our package and class below our comments and a line or two above the public declaration of class Main. Now just below the class declaration and above the constructor we need to create a copy of the class: private HelloWorld hw; Once we have done this we can create an instance of the class with in the constructor of the class Main: hw = new HelloWorld(); hw is the object instance of the class HelloWorld from the example_one package. Still though, the hw object is mostly useless so we are going to now evoke one of its public methods and display it to the console; System.out.println(hw.getHelloWorld()); So, what's going on here: - The object hw is evoking the public method getHelloWorld. - The public method getHelloWorld is returning the value contained from with in the string hk. - The sys print line statement is taking this value and displaying it to the console. What's a console. In eclipse it's a scrollable edit screen that amongst other things displays system generated messages such as "Hello World". You can view the console in Eclipse with alt W + V + C.. Closing the console is accomplished with alt dash c. Here is a fully compiled version of what I've been rambling about for the last little while: package main; /* * entry point of application */ Import example_one.HelloWorld; public class Main { private HelloWorld hw = null; public static void main(String[] args) { hw = new HelloWorld(); System.out.println(hw.getHelloWorld()); } } Ok, here we go and I'll let others chime in if they want to add to this tutorial. This section deals with debugging with in Eclipse and does not cover issues related to a web server or ant build. Why do we debug.... Usually it's because we have a bug in the app or there is an undesirable side affect that needs some attention. ...more or less debugging in Eclipse is rather accessible with JFW.... There are a few limitations namely the two areas that I had mentioned in a previous post which I might add that no one has stepped up to the plate and offered their skill and time to fix.... So in order to begin the debugging process, you will first need to know the area that's causing the issue. How you determine this is purely up to yourselves. Myself, I try to find a beginning point such as an event that triggers a process or processes that will eventually cause my desired affect. So let's say that upon a click event of a button for the purposes of this example I place a break point. CTRL + SHIFT + B will place the break point upon the line of interest. You don't need to have the cursor on the beginning of the line I might add. Ok, we now need to run the application to the point where it will suspend. Press F11 to enter the Debug Perspective and launch the app in debug mode. Since we are suspending on a click event we need to get the application to the point where we can actually click the button in question. Usually this will entail data entry, some screen navigation of some sort. So now we have clicked the button. Eclipse at times may seem to hang and can be rather slow in responding but this is typical behaviour so don't panic. Hey sounds like the title of a book. If you listen, generally JFW will announce something like "Debug Mode" and the name of the class in which the break occurred. Usually this will be announced twice then followed by "Edit".... If after a few moments this is not the case, press F12 to activate the editor. Again if nothing is announced, cycle through the open windows using TAB + SHIFT until you hear the editor window announce. You can take note that you are on the line of suspension which actually can be the line after the break point in certain circumstances. ....more later, my poor fingers are bleeding. J. James M. Corbett Programmer / Analyst | Canada Revenue Agency | Agence du revenue du Canada 875 Heron Rd. Ottawa, On. K1A0L5 James.Corbett@xxxxxxxxxxxxx Telephone | Téléphone: (613) 941-1338 Facsimile | Télécopieur: (613) 941-2261 Government of Canada | Gouvernement du Canada +++ The last time I wrote about breaking a program at a specific line of execution. Remember that there can be more than a single break point in your application and via other tools on the market, it is possible to debug with in other processes. So now that we have broken the execution, where do we go from here?...as previously mentioned we can inspect / interrogate other members that are in scope. Usually "In Scope" applies to members that have public visibility to a class e.g. Private String myString; myString can be seen through out the life cycle of a class. Members of a method on the other hand only have scope while with in their method and depending upon where the line of suspension is, they may or may not have been initialized. An easy mistake to fall into is to inspect a member that was set to null as part of its initialization. E.g. RecordSet rs = null; If this member is inspected prior to it being used, it will return a value of null therefore confusing you at times. So, what is "Inspection" and how do I use it. If you bring your cursor to a member such as rs in the above example and then pressing CTRL + SHIFT + I will bring you to the Inspection View / Window. ...by default you are placed on a tree view and there will usually be a single parent node on the tree. Pressing the down arrow once will identify the member you have selected and usually will announce some meaningful data.... One thing to note is that if you press the TAB key once to view the content of the member, you will need to use the key combination TAB + CTRL + SHIFT in order to bring your focus back to the tree view. Members of primitive data types will display differing bits of information and that is also confusing. Strings on the other hand are not primitive and are objects so they will display other information such as the size of the member if hydrated. Another extremely powerful view is the Variable View / Window. If you have halted the application you can view the values of members that are with in the scope of a class.... ALT + W + V + V while in the Debug Perspective and then press the enter key. A Tree view will be displayed and depending upon how many objects / members you have instantiated you could have a large number of parent nodes. Each node then can have a one to many relationship and therefore each of these children can have a one to many relationship. It can be overwhelming but with a little bit of practice the navigation becomes rather straight forward. The Variables view navigates in the same manner as the Inspection Window so there is no additional key strokes to use. I set a number of options on my project and so far I haven't been able to isolate which option has the spill over affect but I can close many of these views with a single press of the ESC key. If anyone has determined the option that causes this affect I would be happy to know. One thing to note is that either an array / collection or Hash Map are quite cumbersome to navigate, for example you may have an array that is: Double [12][31] by default you could have as many as 372 elements for inspection. When I'm debugging an application, I generally stay away from multiple Break Points" due to my limited brain capacity. However I no for sure that there are some of you that insist on having multiple halts in your debugging, but how do you keep track of them. Well Eclipse does offer a means. Using the key combination: ALT + W + V + B will display a view with a list of Break Points" if any. Simply scroll the list and press enter to locate the area of interest. So next time I'm planning to write about other ways of debugging in Part III. Jim James M. Corbett Programmer / Analyst | Canada Revenue Agency | Agence du revenue du Canada 875 Heron Rd. Ottawa, On. K1A0L5 James.Corbett@xxxxxxxxxxxxx Telephone | Téléphone: (613) 941-1338 Facsimile | Télécopieur: (613) 941-2261 Government of Canada | Gouvernement du Canada -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of black ares Sent: Wednesday, August 25, 2010 8:28 AM To: programmingblind@xxxxxxxxxxxxx Subject: Re: Eclipse: Totally Dumb Questions I am using a screen reader, namely Jaws for windows from freedomscientific. Yes, I will write a short eclipse tutorial. ----- Original Message ----- From: "Alex Midence" <alex.midence@xxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Tuesday, August 24, 2010 9:46 PM Subject: Re: Eclipse: Totally Dumb Questions > I'm glad you are finding it so easy to use. Perhaps, what needs to > happen is for anyone who uses this Ide as a blind person to write a > short tutorial about it from the perspective of a screen reader user. > Do you use a screen reader or a screen magnifier? If a screen reader, > which one do you use? > > > Can you write something brief describing how to write and compile a > short hello, world program in Java? > > Thanks. > Alex M > On 8/24/10, black ares <matematicianu2003@xxxxxxxxxxx> wrote: >> Hmm, for me, is very simple to work with eclipse. >> There are some kind of concepts you must understand. >> First of all there exists a perspective. >> A perspective is a preconfigured eclipse workbench for a purpose. >> For example there is j2ee perspective, >> php perspective >> database design perspective. >> In this perspective you will find open more "views" and "Editors". >> Views are open windows inside the main eclipse window, windows for a >> specific purpose. >> For example in java perspective, >> you will find package explorer, console and so on. >> Tu move around views use the ctrl + f7 key strocke. >> Editors are a special kind of view, that permits editing actions with >> their >> objects. >> I am using eclipse on a daily basis for java development, j2ee >> development, >> birt development, php development, dotnet development. >> >> ----- Original Message ----- >> From: "Alex Midence" <alex.midence@xxxxxxxxx> >> To: <programmingblind@xxxxxxxxxxxxx> >> Sent: Tuesday, August 24, 2010 4:42 PM >> Subject: Re: Eclipse: Totally Dumb Questions >> >> >>> Welcome to the wild whacky world of eclipse the accessible Ide that is >>> a pain in the ahem ... class ... to learn because the obvious isn't >>> obvious and the intuitive stuff never made it into production. It >>> sounds like you are in the project explorer. Tab around and see if >>> you land in a tree view. If you can do this, arrow to your file and >>> use the context menu to edit it. Also type shift alt q to get a list >>> of all the hotkeys eclipse has. >>> Try going to alt w and the show view submenu. See if you can tell it >>> to go to the project explorer if you are not already there. >>> Sorry I can't be of more use. I was using eclipse's cdt for c++ >>> development and eventually gave up on it because, accessible or not, I >>> didn't find the app itself very user-friendly and the manuals I landed >>> on were very sketchy and rather unhelpful to the beginner. I hope >>> your experience is different. You are actually using the IDE for its >>> original intended purpose. The documentation for java developers is >>> probably much more extensive. In fact, now I think of it there are >>> some eclipse manuals on eclipse in the java archive of the nonvisual >>> development site. They are probably for an older version but, you >>> might check them out. They may help you. >>> >>> Good luck, >>> Alex M >>> >>> >>> On 8/23/10, Homme, James <james.homme@xxxxxxxxxxxx> wrote: >>>> Hi, >>>> This is my first Hello World type project, so I'm probably doing >>>> something >>>> totally wrong. >>>> >>>> I get to the part where I tell the program the name of my file. I typed >>>> in >>>> Welcome.java with a capital W. It sounded like an edit window came up >>>> when I >>>> pressed Enter. When I try to type characters just to see if I can read >>>> and >>>> write text, I can't seem to read anything. What am I doing wrong? >>>> >>>> Thanks. >>>> >>>> Jim >>>> >>>> Jim Homme, >>>> Usability Services, >>>> Phone: 412-544-1810. Skype: jim.homme >>>> Internal recipients, Read my accessibility >>>> blog<http://mysites.highmark.com/personal/lidikki/Blog/default.aspx>. >>>> Discuss accessibility >>>> here<http://collaborate.highmark.com/COP/technical/accessibility/default.aspx>. >>>> Accessibility Wiki: Breaking news and accessibility >>>> advice<http://collaborate.highmark.com/COP/technical/accessibility/Accessibility%20Wiki/Forms/AllPages.aspx> >>>> >>>> >>>> ________________________________ >>>> This e-mail and any attachments to it are confidential and are intended >>>> solely for use of the individual or entity to whom they are addressed. >>>> If >>>> you have received this e-mail in error, please notify the sender >>>> immediately >>>> and then delete it. If you are not the intended recipient, you must not >>>> keep, use, disclose, copy or distribute this e-mail without the >>>> author's >>>> prior permission. The views expressed in this e-mail message do not >>>> necessarily represent the views of Highmark Inc., its subsidiaries, or >>>> affiliates. >>>> >>> __________ >>> View the list's information and change your settings at >>> //www.freelists.org/list/programmingblind >>> >> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> >> > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind