Faqts : Business : Programming : Shopping For You : Java

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 9 people (100%) answered Yes
Recently 9 of 9 people (100%) answered Yes

Entry

Java: Borland: JBuilder: X: Stand alone: Create: How to create 'Hello World' console program?

Aug 28th, 2009 11:27
Knud van Eeden, Joe Bloggs,


----------------------------------------------------------------------
--- Knud van Eeden --- 11 January 2004 - 06:37 am --------------------

Java: Borland: JBuilder: X: Stand alone: Create: How to create 'Hello 
World' console program?

---

Steps: Overview:

 1. -possibly start JBuilder X

 2. -possibly close any projects which are open

     1. -select from menu option 'File'

     2. -select from list 'Close Projects...'

     3. -enable the checkbox for the projects you want to close

     4. -click button 'OK'

 3. -Open a new project

     1. -select from menu option 'File'

     2. -select from list 'New Project'

     3. -click button 'Finish'

 4. -Create a new class

     1. -select from menu option 'File'

     2. -select from list 'New Class...'

     3. -enable checkbox 'Generate main method'

     4. -possibly disable all other checkboxes
         if you have already some ready
         made Java console program,
         then you just paste this in

     5. -click button 'OK'

 5. -This will automatically generate some source code
     for you

--- cut here ---------------------------------------------------------

package untitled10;

class Untitled1 {
  public static void main(String[] args) {
  }
}

--- cut here ---------------------------------------------------------

 6. -Now type e.g. in main the following
     code

      System.out.println( "Hello World from Borland JBuilder X console 
application" );

 7. -Run your application

     1. Press <F9>

     - or -

     1. In the menu click on the green '>'
        icon

 8. That will open the dialog box
    'Runtime Configurations'

 9. -click button 'New'

10. -Now indicate the name of that class
     in your program which contains
     the 'main()' method

     1. click button '...'
        on the right of 'Main class'

     2. this shows a large list of
        classes

        1. -browse down to the name of your
            current program
            (e.g. 'Untitled1')

        2. -Click on the '+' to expand

        3. -Select the name of that class
            (e.g. also 'Untitled1')

        4. -click button 'OK'

     3. -click button 'OK'

     4. -click button 'OK'

     ---

     Note: if you run your application and
     JBuilder informs that it can not find
     your main method, then almost for sure
     you have to repeat this steps here
     to indicate exactly that name of that
     class in which your 'main()' method
     can be found

11. -Run your application again

     1. Press <F9>

     - or -

     1. In the menu click on the green '>'
        icon

12. -That should show e.g.

      Hello World from Borland JBuilder X

     in the messages window

13. -If you want to run this file outside your
     JBuilder, look e.g. at the path of this
     file (that is on the top of the form)

     1. Your java source files are by default located in your
        home directory, then directory 'jbproject'

      e.g.

     c:\documents and 
settings\administrator\jbproject\consoleapplication1
\src\consoleapplication1\frame1.java

     2. Your classes are located in the 'classes' directory there:

      e.g.

     c:\documents and 
settings\administrator\jbproject\consoleapplication1
\classes\consoleapplication1\frame1.class

14. So from the command line you could run your hello word program by 
running 'javaw.exe', e.g. type:

     1. Open an MSDOS box

     2. Type or paste the command (which you find and can copy to the
        clipboard
        (put e.g. your cursor inside in this 'Message' box in JBuilder,
         then press e.g. <CTRL><A>, then <CTRL><C>)

         C:\JBuilderX\jdk1.4\bin\javaw -classpath "C:\Documents and 
Settings\Administrator\jbproject\untitled10\classes;C:\JBuilderX\jdk1.4
\demo\jfc\Java2D\Java2Demo.jar;C:\JBuilderX\jdk1.4
\demo\plugin\jfc\Java2D\Java2Demo.jar;C:\JBuilderX\jdk1.4
\jre\javaws\javaws.jar;C:\JBuilderX\jdk1.4
\jre\lib\charsets.jar;C:\JBuilderX\jdk1.4
\jre\lib\ext\dnsns.jar;C:\JBuilderX\jdk1.4
\jre\lib\ext\ldapsec.jar;C:\JBuilderX\jdk1.4
\jre\lib\ext\localedata.jar;C:\JBuilderX\jdk1.4
\jre\lib\ext\sunjce_provider.jar;C:\JBuilderX\jdk1.4
\jre\lib\im\indicim.jar;C:\JBuilderX\jdk1.4
\jre\lib\im\thaiim.jar;C:\JBuilderX\jdk1.4
\jre\lib\jce.jar;C:\JBuilderX\jdk1.4
\jre\lib\jsse.jar;C:\JBuilderX\jdk1.4
\jre\lib\plugin.jar;C:\JBuilderX\jdk1.4
\jre\lib\rt.jar;C:\JBuilderX\jdk1.4
\jre\lib\sunrsasign.jar;C:\JBuilderX\jdk1.4
\lib\dt.jar;C:\JBuilderX\jdk1.4
\lib\htmlconverter.jar;C:\JBuilderX\jdk1.4\lib\tools.jar"  
untitled1.Untitled1

     3. Change after pasting the name 'javaw' to 'java', otherwise you 
might not see too much happening

     ---

     Note:

      you will possibly have to adapt this file paths to the situation 
on your machine,
      but copy paste should do usually.

---
---

Internet: see also:

---

How can I create a simple "Hello World" / console application in 
JBuilder?
http://bdn.borland.com/article/0,1410,27997,00.html

---

Java: Borland: JBuilder: X: How to create a 'Hello world' stand alone 
windows application?
http://www.faqts.com/knowledge_base/view.phtml/aid/28206/fid/165

----------------------------------------------------------------------