• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can i set path and classpath?  RSS feed

 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i set path and classpath?
where to set it?
Does classpath come in to picture at runtime only or it plays any role compile time?
 
Sanjeev Kulkarni
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out - http://java.sun.com/docs/books/tutorial/java/index.html
 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanjiv,be specific..
 
priya shende
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Follow this steps:-
1)Search javac.exe.
2)Then from command prompt go to the directory in which you have saved the program.
3)for example if you found javac.exe in c:\program files\java\jdk1.5.0_12\bin
and you saved java program file in c:\priya> then give following command
c:\priya>set path=%path%;c:\program files\java\jdk1.5.0_12\bin;.;
press enter
4)for classpath give following command
c:\priya>set classpath=%classpath%;c:\program files\java\jdk1.5.0_12\bin;.;
press enter.
 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks priya...
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See How To Set The Classpath in the JavaRanch FAQ, and the JDK installation instructions.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12529
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by tushartrue fasate:
sanjiv,be specific..

It would also help if YOU were specific. how you set this does depend on what operating system.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by priya shende:

4)for classpath give following command
c:\priya>set classpath=%classpath%;c:\program files\java\jdk1.5.0_12\bin;.;
press enter.


Disagree. You don't normally need to do anything with the classpath for simple beginner's programs, and you certainly don't want your jdk/bin folder in the classpath.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by fred rosenberger:
... It would also help if YOU were specific. how you set this does depend on what operating system.

Exactly.

It would also help to know why you want to set your classpath, because as Campbell pointed out, this often isn't needed at the beginner stage.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, Marc, this is because you see books with "how to set PATH and CLASSPATH" in, and they don't tell you that the CLASSPATH is usually set up correctly anyway.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in the old days (I think it was before Java 1.3), you actually did need to set the classpath for Java to find it's own API classes. Outdated information dies hard.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!