Results 1 to 10 of 11
I wasnt sure if this should go into the programming thread, but im sure its more fitting for an installation/newbie question.
Im running mandrake 9.1 (old i know, but for ...
- 03-24-2004 #1Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
Installing Java software development kit
I wasnt sure if this should go into the programming thread, but im sure its more fitting for an installation/newbie question.
Im running mandrake 9.1 (old i know, but for some reason the iso's i downloaded twice wouldnt boot from CD and also failed burning when i used nero 6 from windows. So i gave up after 6 useless disks now sitting around as coasters.
Relevent information:
What im questioning is, how do i compile a *.java document after i have created one? I thought i may just be able to go to terminal and type 'javac test.java' (for a file named 'test.java' and that would compile it, or atleast give a failure (for bad coding) but it says that the command is unrecognized. (in the usual non-existant command way)
Im just wondering in that case have i either installed it wrong, or perhaps i should use an actual java compiler? Or perhaps there is another compiler command i should use instead?
Thanks in advance for any help!/skythra
- 03-30-2004 #2Just Joined!
- Join Date
- Mar 2004
- Location
- Loda, IL
- Posts
- 32
I suggest 2 possibilities. One: javac is not in your path, therefore the shell can't find it. Update ld.so.config to include the path to javac. Two: just type in the entire path to javac when you use it, and forget about updating ld.so.config.
- 03-30-2004 #3Linux Newbie
- Join Date
- Aug 2001
- Location
- USA, Texas
- Posts
- 217
your $PATH is definately your problem. You need to find the full path to the java bin directory ... maybe /usr/share/j2sdk1.4.2/bin ( I just spoke to someone about this on irc earlier today ... may have been you ... I don't know) ... anyway ...
lets assume that your path to your java executables is as stated above ...
at a shell prompt type:
then try executing javac and/or which javac. If you are successful in running javac then you need to add it to your path perminantly.Code:export PATH=$PATH:/usr/share/j2sdk1.4.2/bin
If you are only concerned with using java as the one user then you can modify your ~/.bash_profile. Find the line like: PATH=/bin:/usr/bin/: .... and append :/usr/share/j2sdk1.4.2/bin to the end.
If you want to add it to the path of every uses, then you should do the same thing as above except on /etc/profile instead of ~/.bash_profile[ [ SykkN alloc ] initWithThePowerTo: destroyYouAll ];
/* Don\'t make me use it! */
- 04-04-2004 #4Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
Thank you for the help.
Edit: And for your information i need the compiler. =D Its about all i really need. Im in my sixth week into the course and i still havnt got the thing working. Im still making sure the install is right i think i left out a couple of things and then ill start working out the paths etc.
Edit2: The path code seems to be a big hit, i havnt had the chance to do a test compile, but it now recognizes the various commands. Thanks alot the help is muchly appreciated. Now just to solve the following programming problems!/skythra
- 04-05-2004 #5Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
Now im testing the code right, and im doing a basic example, im wondering if this error means im missing something in the installation, or have i just made a mistake in the code?
Error:
The java file:Code:[skythra@STUDY Documents]$ javac Convert.java [skythra@STUDY Documents]$ java Convert.class Exception in thread "main" java.lang.NoClassDefFoundError: Convert/class [skythra@STUDY Documents]$
Again, all help is appreciated.Code:/* ** file: Convert.java ** ** created: dd/mm/yy ** ** author: Skythra */ import TerminalIO.*; public class Convert { KeyboardReader reader = new KeyboardReader(); ScreenWriter writer = new ScreenWriter(); double pascal; double torr; public void run() { writer.print ("Enter pressure Torr: "); torr = reader.readDouble(); pascal = (torr*133.3224); writer.print ("The equivalent in pascal is: "); writer.println (pascal); reader.pause(); } public static void main (String [] args) { Convert tpo = new Convert(); tpo.run(); } }
/skythra
- 04-07-2004 #6Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
Just a note that i have tested this with over 10 different class files and none of them work. All have the same error: if you think you know what it causing this, please reply!
I assume that java just cant understand the class but i dont know why!/skythra
- 04-08-2004 #7Linux Newbie
- Join Date
- Aug 2001
- Location
- USA, Texas
- Posts
- 217
Skythra, I think that your only problem is that you are using the class file with the .class extention.
instead of: java Convert.class
do: java Convert
see if that works for ya.[ [ SykkN alloc ] initWithThePowerTo: destroyYouAll ];
/* Don\'t make me use it! */
- 04-12-2004 #8Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
I feel so stupid right now.
So very stupid. I assumed... anyway. Next question! Thanks for that =D
I know this was explained in the above post where sykkn carefully told me how to perminantly add the commands for the java code... but i didnt really quite understand. All i know is im supposed to at a point in my bash profile which looks like:and im suppposed to add the lineCode:# /etc/profile -*- Mode: shell-script -*- # (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> loginsh=1 # Users generally won't see annoyng core files [ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then PATH="$PATH:/usr/X11R6/bin" PATH="$PATH:/usr/share/j2sdk1.4.2/bin" fi if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then export PATH=$PATH:/usr/games fi umask 022 USER=`id -un` LOGNAME=$USER MAIL="/var/spool/mail/$USER" HISTCONTROL=ignoredups HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi # some old programs still use it (eg: "man"), and it is also # required for level1 compliance for LI18NUX2000 NLSPATH=/usr/share/locale/%l/%N export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH export HISTCONTROL HISTSIZE for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fi done unset ibut all i managed to do was make mandrake unbootable into the skythra profile.... *cough*:/usr/share/j2sdk1.4.2/bin
if anyone has time would they mind just giving me an example? Im not really very good at what i dont understand... sorry *_*/skythra
- 04-12-2004 #9Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
So it will look like this:
Jason# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
loginsh=1
# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1
if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
PATH="$PATH:/usr/X11R6/bin" PATH="$PATH:/usr/share/j2sdk1.4.2/bin"
fi
if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
export PATH=$PATH:/usr/games
fi
export PATH=$PATH:/usr/share/j2sdk1.4.2/bin
umask 022
USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N
export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZE
for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
done
unset i
- 04-13-2004 #10Linux Newbie
- Join Date
- Sep 2003
- Location
- Brisbane, Australia
- Posts
- 123
e_e;; thanks mate, that looks really self explanitory now that you have said it...
And that will would with other things aswell? like say mozilla if i just tacked in the "export path=$path usr/local/mozilla/bin" then that would allow me to use the commands from the mozilla bin folder anywhere?
Thanks for all the help, its really helped me understand alot on how the entire system seems to work =D/skythra


Reply With Quote
