ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Ok, I need help with this on windows right now (and I will then try to figure it out on linux and coe back here and ask when I fail ^_^). Ok, I have java installed on my windows partition and it works great. I now have a .jar file (C:\g5jdk\generation5.jar) that I want to add to the java classpath so I can use all the packages and classes in it. So, I went to the enviroment variables section of System in the Control Panel. There was no CLASSPATH variable so a made a new one and set it to ".;C:\g5jdk\generation5.jar" and saved it. Now I try to run a program that imports classes and packages that should be in said .jar file and it won't compile (no class def found). What am I doing wrong here? Any help welcome. Thanks.
Hello and thanking everyone helping out there!! You guys have no idea how much of appriciation me and my firend's got for everyone's whose helping out in this site!!
I need to know if anyone could tell me a way to compile my java programs without giving the javac path....like
i have just installed java. And its a bit of time taking by giving the whole path like i had typed above. Could someone give me an idea to straight forwardly make it to understand the "javac" and "java" commands from the command prompt....i.e
azzath@d_hyper java_programs]$ javac
bash: javac: command not found
without getting this error message...
Thanks in advance.
anyone who is trying to install java then hopefully this site would help i guess, cuz i got help from this site. http://home.bredband.no/gaulyk/java/...avaredhat.html
Thank you buddy...
But thats wha i'm trying to do. But i am not sure how to fit in..
export PATH=$PATH:/usr/java/jdk*/bin/ into export PATH=$PATH:/usr/games(which is the "profile" script in the /etc directory)
If yu know anything about it please let me know.
So is that your site..
It looks cool..i havent surfed verymuch into it...but sould be very educational.
Thanx again mate.
Ok, given you're doing this for Windows.
(Instructions based on Winblows 2000)
Right-click on "My Computer", select Properties.
Advanced tab, New button in top "User variables for ..." section.
Variable Name: JAVA_HOME
Variable Value: <path to your java install>
(not directly to it's bin directory, or anything)
Also it probably couldn't hurt to add it to the PATH variable:
In bottom "System variables" section, find Path in list and press Edit button.
Append path above, with bin dir added, prepended by a ; to Value.
Sorry, sure you didn't need these baby steps, but avoids the potential for confusion.
could some one please tell me if this is the right file to edit which is profile (but in the above site mensioned the person told to edit the /etc/profile.d/java.sh file ( where there wasnt such a file). But i still created a file named java.sh and just gave the line export PATH=$PATH:/usr/java/j2sdk1.4.2_07/bin. I know this is not right. I'm sorry, i am not a programmer, but keen in learning java.
But i would like to solve this problem and would some one tell me what might be going wrong ?
Let's see... The PATH environment variable contains a list of directories that are searched whenever you type a command. You say that you get "command not found" if you type "javac". So could you please type
and post the output? Because after all the changes you have made, there should be some differences :-).
Which shell are you using anyway? Please type
and post the output. If you are using bash (which is the default), then whenever you login, /etc/profile is read and executed. Therefore, if you change the content of /etc/profile (i.e. add commands that change the path), then changes should be visible at your next login. Did you log out and back in after changing?
Sometimes, /etc/profile contains a piece of code that reads all files in /etc/profile.d, and executes them as well. This is distribution dependent. If your /etc/profile indeed has this piece of code, then there should be no difference between editing /etc/profile, and editing any file in /etc/profile.d. But, as said, this depends on this piece of code in /etc/profile.
By typing "export PATH=", you can give the path an entirely new value. $PATH gives you the current (or old value), so
basically says "The new value of my PATH should be equal to the old value, plus some stuff concatenated".
If you have only one j2sdk directory, then you can use a * to save you some typing. So, the above could also be written as
If you have only one directory, then this is convenient, because it will figure out the version stuff by itself. If you have several, then this will not work, and you'll be able to use neither. Therefore, I generally do not recommend it.
Quotes can be used for pathnames that contain spaces and some other weird characters. Even so, you probably shouldn't use spaces and weird characters in pathnames anyway. Furthermore, when using quotes, the * trick above doesn't work anymore.
Thanking you kees-jan and the rest who had helped me out with my roblem,
Kees: i initially thought that logging out means come out of "su", then when i swiched my computer on this morning the javac command worked
First thing i did was reading ur message and when i went to play with it again by doing an echo $PATH it showed me the path as below, then i tried the javac command and it listed javac and java and it worked well Buddy.
[azzath@d_hyper azzath]$ echo $PATH
[azzath@d_hyper azzath]$ echo $SHELL
I really appreciate for the time and effort you took to explain me all this. Thanking you again.
And also i would like to thank the senior member jlliagre, for his long time effort.
Take care guys.
Ideally, you should remove the two entries with stars in them "/user/java/jdk*/bin/", because they don't do anything but confuse things. The entry "/usr/java/j2sdk1.4.2_07/bin" is sufficient and should remain.