It is quite simple to make Java program without BlueJ
Download Java
Install the package
Set up the environment first
Go to Control Panel and open System then choose the Advanced System Settings
It is quite simple to make Java program without BlueJ but you must set up the environment firstGo to Control Panel and open System then choose the Advanced System Settings In the new window choose Environment Variable
Check if CLASSPATH has been set and the path variable has the path to your JDK folder. You must remember if you set it up yourself then put a dot as the first item in the CLASSPATH and then the path where your jar files are stored(search for them)
Make sure you put the path where your javac.exe file is stored most probably it will be inside on this path C:\Sun\SDK\jdk\bin
Once this is done you are ready to go
Fire up NotePad and type the following snippet
[caption id="attachment_28" align="aligncenter" width="512" caption="First Java program"]
Now you must remember 3 things
1) Where you are saving this code
2) Name of the file should be entered in the file save box as "ABC.java" Nothe double quotes, it is important you do this or else in most systems notepad will save it as ABC.java.txt.
3) The name of the file must be same as the class name.
[caption id="attachment_29" align="aligncenter" width="650" caption="Mind the doule quotes and name of the file"]
Compile and Run
Open the DOS prompt, if you cannot find it on vista just type cmd on the start menu and the icon shown will be DOS Prompt.
I hope you know where you have stored your file ABC.java, navigate to that place. I will not cover DOS commands, if you need help leave a comment
When you have reached the place where you have stored the file just type the following command
javac ABC.java
if there is any error it will show up other wise it will show nothing just the prompt will come back
then type java ABC
and you should get a message Hello World just below the prompt, congratulation you have your first Java program
No comments:
Post a Comment