CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   simple .java file (http://www.codingforums.com/showthread.php?t=15939)

Aymen++ 03-08-2003 09:57 AM

simple .java file
 
how can i make a simple .java file in JBuilder?
for example a helo world file...

Spookster 03-08-2003 04:13 PM

class HelloWorld{

public static void main(String args[]){

System.out.println("Hello World");

}//end main

}//end class

Aymen++ 03-08-2003 04:17 PM

no, i didn't mean that, i meant how to make new file (.java) in JBuilder.
for more illustration: where should i copy and paste this code?

Spookster 03-08-2003 04:23 PM

Well you could read the help files that come with it. Been a few years since I used it but you should create a New Project and then add a java source file to it. Can't remember all the menu choices.

Josh Campbell 03-09-2003 12:43 AM

First make a new project, File -> New Project. Then just follow the wizard to set it up. Then make a new class File -> New Class and also follow its wizard. Make sure the name of the class is the same as .java (HelloWorld if you use the code spook provided). Then to compile your project goto Project -> Make Project and then Run -> Run Project to run it.

Spookster 03-09-2003 02:46 AM

Quote:

Originally posted by Josh Campbell
if you use the code spook provided)
I had a typo in that code and you didn't catch it. Shame shame. :D

I fixed it now so you will never know what it was.

Josh Campbell 03-09-2003 04:25 AM

I assumed that someone as skilled as yourself would not have made any typos or errors. :D j/k

Aymen++ 03-09-2003 07:58 AM

but when i choose run a dialog box named project properties will apear...
i choosed new from that dialog, another dialog will apear, then i made the main class: HelloWorld.HelloWorld, then i clicked ok to close this dialog, after that i clicked run and this error appeared to me:
Could not find the main method. Program will exit!
Why:confused:

Josh Campbell 03-09-2003 03:10 PM

Make sure you chose application as type and that you have the package setup correctly. Whenever you paste in spook's code, keep the thing that says package HelloWorld;

Aymen++ 03-09-2003 06:11 PM

i did it!!! and the same problem...

Josh Campbell 03-09-2003 08:13 PM

Ok heres the process again, this works for me

1. File -> New Project
2. Name your project then press finish
3. File -> New Class
4. Name your class then press finish
5. Copy and paste spook's code, remembering to keep package thing in there
6. Project -> Make Project
7. Run -> Run Project
8. Click New
9. Choose Application as type
10. Choose the class you just made as main class.
11. Run -> Run Project

Aymen++ 03-09-2003 09:25 PM

Ok thank you very much, but where can i see the output of my project?

Josh Campbell 03-09-2003 09:44 PM

Output using System.out is displayed in the bottom text area thing, right below where the classpath and the call to the java interpreter are displayed.

mattyb 03-13-2003 09:33 PM

Hmmm. I use ready to program in Java from Holt software it's cool but sometimes a little buggy. Still I prefer over Jbuilder.

The Bee


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.