Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to compile/interpret ur own package's classes

 
Malik Tahir
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i m getting error when i compile this code:
package A;
class B {
public static void main (String arg[]){
System.out.println("Hello");
}
}
I made a folder in jdk1.3 with the name of A and put this file in that folder. And then compile it with the command C:/jdk1.3/bin>javac A.B.java
I have tried even C:/jdk1.3/bin>javac B.java
but compiler complaints that it did'nt find this class.
Plz help me out.
Thanks in advance
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try :
C:/jdk1.3/bin/A>javac B.java
 
Malik Tahir
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravish,
I tried that one but still i m getting the message "Bad Command or File name".
Thanks
Tahir
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bad command" is because the "javac" command is not recognized since you are not in the bin directory. What I recommend you to do is set your PATH variable to include C:\jdk1.3\bin and that way you can call javac from anywhere.
Moreover, I'm moving this to Java in General (Beginner).
HIH
[ January 15, 2002: Message edited by: Valentin Crettaz ]
 
Malik Tahir
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Valentin,
Thanks a lot for ur valuable recommendation.
Plz tell me how can i set path. i m using windows and notepad.
Thanks in advance
Tahir
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go to Windows help and look it up.
You need to include the location of your bin library - someting like:
PATH .;D:\jdk1.3.1\bin;D:\jdk1.3.1\MyStuff;%PATH%;
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us which windows are you using?
 
Malik Tahir
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I m using Window 98.
 
Marius BONG
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to go to dos and make sure your path is C:\
then type:
C:\edit autoexec.bat
if the blue screen is empty, click file and open file called autoexec.bat
in autoexec.bat add in this line:
SET PATH C:\jdk1.3.1\bin
and then restart your windows. you will be able to compile and run your java where ever you like.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic