problem in runing a program
Dear fellows,
I m new to java programming i write the hello world in JDK and its been complied properly without any errors but its does not show any output on the screen i have also check the class file its been created .
So any one can please guide me how can i make the output visible
Thanks
[318 byte] By [
Addicteda] at [2007-10-1 9:00:00]

Hello,
Maybe you could post some code (don't forget to use the code formatting by pressing the *code* button ;-)), so that we could have a clearer idea of what you are trying to do ?
Usually, to output something to the console (when running a code from command line), you must use the System.out.println() method.
Hope this help !
I m using System.out.print() for displaying in the common promt but nothing comes after the compliation.
I have to do an assignment on java but due t o this i m stuck please help me out
II write this program
public class welcome1
{
public static void main( String arg[] )
{
System.out.println("HI");
}
}
Save it as welcome1.java in C:\src\welcome1.java
when i open the command promt and write
javac c:\src\welcome1.java the cursor blink for a while and then
C:\> this comes on the screen
the compiler complies the program but the output (HI) does not come on the screen
Hello,
By using javac
command, you only COMPILE your program... You are not actually running it...
To run it, you have to run the follonwing, from command prompt:
java c:\src\welcome1
Hope this helps...
PS: you didn't use the code tag to post your code. Code lines are more easily readable when you post them using the code button
> To run it, you have to run the follonwing, from> command prompt:> java c:\src\welcome1> The argument to the java.exe launcher is a CLASS NAME, not a file path name. The command should look more likejava Welcome1
true ;-) sorry, not enough careful when copy/pasting ;-)
and, by the way, you have to run this command from the directory where your class resides, or your have to specify the path to this directory in your classpath
Dear Fellows when i use the C:\> java welcome1. i found the following error on my screen Exception in thread " main" java .lang.Noclassdefound error: Welcome 1 Can u guys pls help me in that
> Dear Fellows when i use the C:\> java welcome1. i
> found the following error on my screen
>
> Exception in thread " main" java
> .lang.Noclassdefound error: Welcome 1
>
> Can u guys pls help me in that
Java is case sensitive. If the class is named welcome1 then the command should be "java welcome1" and if the class is named Welcome1 then the command should be "java Welcome1" (Sorry if I confused that part, I did not look closely at your first post.)
The recommended way to let java know where to look is to use the -classpath option. If your .class file is in the current directory and the class name is Welcome1, then use java -classpath . Welcome1Notice the spaces and the dot(.) between -classpath and Welcome1.