Java Basics... Make an Hello cmd window...

Posts 19 of 9 · Page 1 of 1
Java Basics... Make an Hello cmd window...
So lets start, in this tutorial i will explain how to do an hello window that will appear in a CMD window...

1st Step:

Go to your desktop, Left click and make a new .txt file...
Name it to Hello.java
After Editing the name, double tap it, a window will open...
Type on in the following code:
Code:
public class Hello {
public static void main(String[] args) {
system.out.println("Hello");
}
}
Then, Save the file and Close it...

2nd Step:

Go to your desktop again, and make a new .txt file, name it to Compile.bat, Left click the file, and press "Edit", Then type the following on it:
Code:
@echo off
title Compile
javac*.java
pause
Now... Save and close it.

3rd Step:

Double tap your compile.bat file, wait some seconds, and there wil appear: Press any key to continue... when it appears, press any key like it says and it will close, a new file will appear on your desktop named of: "hello.class"

Now... Create a new .txt file in your desktop and name it to Run.bat Left Click it, press Edit and type there the following:

Code:
@echo off
title Hello
java Hello
pause
Save and close it...

AND YOUR FIRST JAVA SCRIPT IS DONE!

Now to run it double tap the run.bat... and done!


Explanation
"system.out.println[B]("Hello")" Will show whatever you want, any message you want in your hello java program... In this case, it will show Hello, If you want to add another thing, just remove the ("Hello") and add ("whatever you want here")...

"title Compile" You can change the title to whatever you want: title Whatever you want here...

I HOPE YOU UNDERSTAND!

Remember to use the THANKS BUTTON instead of just saying thanks in a reply!

Have Fun!
It says its not recognizable as an external command when i try to compile it. Am i doing somthing wrong?
Maybe.... It Works perfectly for me...

Are you using Windows Vista?
Quote Originally Posted by Xray3109 View Post
It says its not recognizable as an external command when i try to compile it. Am i doing somthing wrong?
You have to have a java compiling tool for "javac" to be a recognizable command.
lol this is easy
I think it would be easier to get the bins and hook'em up to an IDE. Its a pain in the ass to do that for every project. Netbeans -_-
Lol, I hear you jetamay.
^_^ He is right
i hate java, silk[HAX] take the mgph goals out of your sig there not even upto date
Posts 19 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Need help?