LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-11-2006, 11:55 AM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Rep: Reputation: 31
Make javac working globally


Hey there!!!
Im a newbie to Linux and i want to ask smth simple
I downloaded java compiler and i installed in to 'home/me/Desktop/jdk1_5_0_09'.
Well! What I want is to make the compiler working wherever i got a java file to compile
Rigth now i can use only javac in the bin dir where javac is.

Really thanks for your time
 
Old 11-11-2006, 12:33 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Put:
Code:
export PATH=$PATH:/home/me/Desktop/jdk1_5_0_09/bin/
in (ideally) your /home/me/.bash_profile file or alternatively your /home/me/.bashrc file
 
Old 11-13-2006, 03:47 PM   #3
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Original Poster
Rep: Reputation: 31
javac still doesnt work

Thanks a lot for your reply.
Well!!!It worked but it worked only one time
When i closed the terminal javac still doesnt work
Maybe any other idea?
 
Old 11-13-2006, 05:24 PM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
Quote:
Originally Posted by manolakis
Thanks a lot for your reply.
Well!!!It worked but it worked only one time
When i closed the terminal javac still doesnt work
Maybe any other idea?
You need to put the commands in your .bash_profile as suggested above.
 
Old 11-14-2006, 07:21 AM   #5
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Original Poster
Rep: Reputation: 31
javac still doesnt work

Hey again!!!
Well!!! i found this time my bashrc file and i inserted the given code in it but unfortunately that still doesnt work
Anything else that i can do

Thanks a lot
 
Old 11-14-2006, 07:49 AM   #6
Eliot
LQ Newbie
 
Registered: Sep 2006
Distribution: Slackware
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by manolakis
Hey again!!!
Well!!! i found this time my bashrc file and i inserted the given code in it but unfortunately that still doesnt work
Anything else that i can do

Thanks a lot
It would be good if you say what distribution you use!!

If you insert it to your .bashrc it will work after the next reboot or when you open a new console window.
 
Old 11-14-2006, 08:03 AM   #7
dsids
Member
 
Registered: Mar 2006
Distribution: FC4
Posts: 184

Rep: Reputation: 31
I use FC4..To run javac globally, I insert the line
PATH=$PATH:/path/to/dir/containing/javac

As the export statement is already mentioned..u need not use the export statement in the /etc/profile

Danish
 
Old 11-14-2006, 08:03 AM   #8
dsids
Member
 
Registered: Mar 2006
Distribution: FC4
Posts: 184

Rep: Reputation: 31
Quote:
Originally Posted by dsids
I use FC4..To run javac globally, I insert the line
PATH=$PATH:/path/to/dir/containing/javac

As the export statement is already mentioned..u need not use the export statement in the /etc/profile

Danish
insert the line in /etc/profile

Danish
 
Old 11-14-2006, 12:37 PM   #9
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Original Poster
Rep: Reputation: 31
javac doesnt work

Thanks all of you for your help
Unfortunately i reboot it but nothing changed
I am using BackTrack. (if that helps)
When u say that "u need not use the export statement in the /etc/profile",
you mean that i have to make a change in my bashrc file which is placed in 'home/me'? I apologize but i am quite newbie .

Thanks again
 
Old 11-14-2006, 02:40 PM   #10
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Quote:
Originally Posted by manolakis
Thanks all of you for your help
Unfortunately i reboot it but nothing changed
I am using BackTrack. (if that helps)
When u say that "u need not use the export statement in the /etc/profile",
you mean that i have to make a change in my bashrc file which is placed in 'home/me'? I apologize but i am quite newbie .

Thanks again
OK, in your /etc directory there is a file called profile.

So
Code:
cd /etc
nano profile
(now add the export line I gave you above)
[press CTRL and O to write to disk, then CTRL and X to quit]
I notice that every time you have referred to your bashrc file... I don't know if you know but it should have a dot (full-stop, period, ...) in front of it because it's a hidden file, hence we refer to it as .bashrc or .bash_profile

I think you must be doing something wrong because what we've told you to do DOES work (and you do need the export part in front of PATH)
 
Old 11-14-2006, 07:17 PM   #11
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Original Poster
Rep: Reputation: 31
javac doesnt work

Hello again!!!
I did everything you said but unfortunately no changes.
I put the command in the .bashrc file as well as in the profile file
There are the same files in my '/home/me' and in '/etc'
I put the command almost in the beginning of those files
There are some other "exports" as well there.
I considered that it should be "declared" in the beginning
If you want you can have a look in the following:


# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
export PATH=$PATH:/home/me/Desktop/jdk1.5.0_09/bin/

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/pgsql/bin:/opt/mono/bin:/usr/local/pgsql/bin:/opt/nessus/bin:."

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
#My colour additions (muts)

#PS1="\u@\h:\w\$ "
#PS1="\[\033[1;34m\]\u@\h:\w\$ \033[0m "
#PS1='\[\e[34;1m\]\u@\h:\w\$ \[\e[0m\]'
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s`
else
eval `dircolors -b`
fi

# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcj javac instead of jdk javac rvindiola Linux - Newbie 2 03-29-2006 09:18 PM
How to make javac (java compiler) available on whole system? tisam Linux - Software 11 02-14-2005 10:11 AM
javac not working (LauroMoura kindly see) nedian123 Programming 2 12-19-2004 12:18 AM
javac not working nedian123 Programming 1 12-15-2004 11:19 AM
Javac not working in Mandrake version of Linux perukhan Linux - Software 1 12-14-2004 03:04 PM


All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration