Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Aysel Kaya   on Oct 04 In Java Category.

  
Question Answered By: Al Allen   on Oct 04

Save ur program as "HelloWorld.java"
and save it in the directory where u have installed jdk.
like C:\jdk1.3\bin
save it in the bin folder.
Go to the Dos prompt and change ur directory to this bin folder
now type javac HelloWorld.java
C:\jdk1.3\bin>javac Helloworld.java
this will compile the program and make the byte code for this,after
successful compilation u will get a file named HelloWorld.class
now type java  HelloWorld to run ur program
C:\jdk1.3\bin\java Helloworld
this should work
Assuming C:\jdk1.3 is the path where u have installed java

Better option is:
save the file in any folder u like
for eg
C:\programs\java
now here u have to specify the path of ur java compiler
set PATH=C:\jdk1.3\bin;
now
C:\programs\java>javac HelloWorld.java
then
C:\programs\java>java HelloWorld.java.


just make sure u write "public static  void main  (String args[])"
and not public static vooid main (String args(])

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to use the compiler Or get search suggestion and latest updates.


Tagged: