File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help in understanding classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Help in understanding classpath" Watch "Help in understanding classpath" New topic
Author

Help in understanding classpath

rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Hi everyone, I am quite stuck at setting classpath in windoxs xp.
I want some information on how set CLASSPATH?
Also i didnt understand last chapter of k&b(Development), if anyone have additional information about it please help


Sage of The Monstrous Toad of Mount Myoboku
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
what didnt you understand?
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
I am using eclipse for running my java program, so i have no knowledge of CLASSPATH. I am finding very difficult to run program from command prompt. So i want to understand this
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
I didnt understand page no 762 from k&b book(javac command and its directory structure)
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
are you available on gtalk or skype so that i can help you ? because answering can be quite painful
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
762 or 792? which book do you have? java 6 study guide right....?exam 310-065
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
hi please help in understaing classpath
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531


i have added you though
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Ankur kothari wrote:are you available on gtalk or skype so that i can help you ? because answering can be quite painful


i didn't understand why this is going to be painful and how the pain can be reduced using gmail or skype ???

avi sinha


SCJP 5.0 SCWCD 5.0
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

We have a rule on javaranch where we encourage people to UseTheForumNotEmail . If you explain anything on forum, then many other people will also be benefited from it. I personally never had any problem answering a question on the forum. Just giving a decent explanation accompanied by any tutorial link can solve even a very complex problem...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
actually i am explaining himeverything related to compiling java filesfrom command promt and setting his environment variables
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Ankur kothari wrote:actually i am explaining himeverything related to compiling java filesfrom command promt and setting his environment variables


that's right but it can be done here too and in fact it will help others too who are having problems in this particular topic as well as related ones.

avi sinha
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
if you want i cant paste the whole chat here
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
i will type the relevant extract here.....many people use netbeans or eclipse...this will help them change to command prompt
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
It is not like that we are it hiding it from other users on the forum but since it will take long process to understand hence we switched to gtalk.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
And by the way, if you people go in wrong direction in classpath concept, we can catch your ears here. How will we know what you are discussing on your gmail. How will we pull your legs?


SCJP 6
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
dont worry...everything is going great here..
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Ankur kothari wrote:if you want i cant paste the whole chat here


there is no need of that my friend. we are not saying that you are having a private chat and we have some problem regarding that. our point is to make discussions here so that it can help others too. it looked like stealing a topic here which is not a good practice.may be somebody else is having the same problem and is expecting an explanation from you and others.just think about that.

avi sinha
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
i know what you mean my friend...actually i had got the same error which gave me headaches...so i wanted to help him...sorry for stealing him away(i seem to be getting in controversies lately)
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Sorry to take conversation in gtalk, we will take necessary steps onward
Sorry those have hurt/
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

Anyone is free to discuss anything privately, we can't stop you from doing that. If a person named A starts a topic and says, "hey this is my problem and this is my mail id, explain me on my email id" we strongly discourage that. First of all sharing your email id publicly is an invitation to spams. Secondly, its like the person asking the question doesn't wants others to learn, he/she just wants to learn himself/herself. Also if you discuss publicly, there are more chances that if anyone describing the problem makes a mistake, anyone else can point that out. Also suppose if a person B actually sends a response to person A about the problem, and if person A has a followup question, person A is kinda stuck with person B about the question. Only person B knows what he/she wrote to person A. So in a lot of ways its better to discuss things publicly. Also there are a lot of tutorials on the internet which explains classpath etc very good. Sun's site also has a very in depth tutorial on everything java...
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
I myself used to assume that I am very good in classpath, never felt any problem in classpath compilation and running, but if you see one yr old post, there is a very long debate on classpath concept, and it came out a great learning for me, as I was going in the wrong direction but I was discussing it in public. If I had done that in private, sure I would have missed some part of classpath.
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Its not that we dont want to share things publicly but its a long process and i have to start it from scratch so we moved to gtalk.
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
hey sorry to everyone, can you tell me the useful links for understanding CLASSPATH
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

rohan yadav wrote:Its not that we dont want to share things publicly but its a long process and i have to start it from scratch so we moved to gtalk.

As I said earlier, whether you discuss anything publicly or privately that's your choice. But sometimes its disadvantageous to discuss something privately as your private talk is with a single person. The level of knowledge of that person might be limited. Even if he/she knows everything, still he/she might forget to tell you a few things. If you discuss something publicly, lets take your classpath example, then others are free to join the conversation. Others might ask a few questions on your topic which you didn't think about. That way even you'll learn better...
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

You can follow a tutorial like the following

http://www.ibm.com/developerworks/java/library/j-classpath-windows/
http://mindprod.com/jgloss/classpath.html
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
So ankit i didnt undestand how to use command like javac -d ../classes com/myClass.java.
I using eclipse previously, so i havnt learned these concepts.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952


Hey both links are really great.
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Both link are very good.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
rohan yadav wrote:So ankit i didnt undestand how to use command like javac -d ../classes com/myClass.java.
I using eclipse previously, so i havnt learned these concepts.


javac : means compile please

-d : means your destination for .class file is

../classes : one up than classes folder (destination)

com/myClass.java : and your source file is here in current directory, there is com folder inside that myClass.java is source file.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

-d is used to specify the destination of your generated class files (as Punit already said). -cp or -classpath is used to specify the classpath...
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
got it sir
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help in understanding classpath