freelanceprogrammers.org Forum Index » Java
silly question! how do u compile a prog?
Joined: 23 Feb 2002
Posts: 7
silly question! how do u compile a prog?
Hi there,<br><br>I know it sounds really stupid.
But I seriously know nothing about computers. How do
you compile a java program? I got some instructions
from my teacher but did not understand a thing! I
tried using J++ (even though i`m not supposed to) but
the problem is, it closes the output window right
away so I don`t have time to copy it. Does anyone have
an easy way of compiling?
Joined: 23 Feb 2002
Posts: 2
silly question! how do u compile a prog?
I use MS J++ at work and you shouldn`t have a
problem compiling if you put your file in a project. Once
in a project, choose the Build option on the toolbar
and select Build (or just hold down Cntl+Shift+B). If
you wish to compile and run it outside of the editor,
go to the MS-DOS Prompt. Map your way to the
directory where the .java file is. Then type: <br>javac
[filename].java <br>If you compile with no errors, another prompt
will appear. To run the program, type:<br>java
[filename]<br><br>Hope this helps.
Joined: 08 Feb 2002
Posts: 8
silly question! how do u compile a prog?
To compile a java program, at the command line
type:<br>javac filename.java<br><br>For example, given the file
MyFirstClass.java<br>which contains:<br>class MyFirstClass<br>{<br> public
static void main(String[] args)<br> {<br>
System.out.println("Hello World");<br> }<br>}<br><br>to compile at the
command line type(case sensitive):<br>javac
MyFirstClass.java<br><br>to run at the command line type:<br>java
MyFirstClass<br><br>and you should see the phrase<br>Hello
World<br><br><br>There is lots of good information at
<a href=http://java.sun.com target=new>http://java.sun.com</a> especially the
Java Tutorial section.
Joined: 23 Feb 2002
Posts: 7
silly question! how do u compile a prog?
Thanks. I managed to do that once but then I
forgot what I did. Now I`m trying to do it again but
it`s adding the form1.java to the project
automatically. So if i compile, it gives me a blank form. If i
delete the form from the project, it gives me an error.
I hope that makes sense! I remember that when it
did compile, the window closed right away. So I was
not able to copy the output. Is there a way I can
keep the window open as in C++?<br><br><br>Thanks a
lot
Joined: 23 Feb 2002
Posts: 7
silly question! how do u compile a prog?
I tried this. but this is what it`s giving me
:<br><br>`javac` is not recognized as an internal or external
command,<br>operable program or batch file.<br><br>do I need to d/l
any programs for that or what? <br><br>Thanks a lot
:)
Joined: 15 Feb 2002
Posts: 11
silly question! how do u compile a prog?
you need to set the path to Java`s JDK?
directory. Substitute the ? with the version of the JDK on
your machine(the directory`s name). Once you set the
path in the environment variables you will be able to
compile and run any .java file from any directory. I
think the problem you`re having is setting the `path`.
Joined: 23 Feb 2002
Posts: 7
silly question! how do u compile a prog?
Thanks a lot! u were right. I finally managed to
compile it. Now I have another question. how do you type
cast in Java? let`s say u have Cost = Quantity *.8763
(float, float, and double, respectively). what should u
put in front of the number to cast? <br><br>Thanks!
Joined: 26 Feb 2002
Posts: 1
silly question! how do u compile a prog?
This web page has some good info. about casting it may interest u.<br><br><a
href=http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html
#27529
target=new>http://java.sun.com/docs/books/jls/second_edition/html/conversions.do
c.html#2752
9</a>
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







