LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-23-2012, 06:20 AM   #1
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Rep: Reputation: Disabled
bash: javac: command not found...


i am using fedora17.few days earlier java programs were running ...but now when trying to run a program it gives the error bash: javac: command not found...
Similar command is: 'java'
 
Old 10-23-2012, 06:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
javac is the java compiler. You don't "run" programs with javac, you'd run them with java, so what are you actually trying to accomplish?
 
Old 10-23-2012, 06:40 AM   #3
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
but using javac i am trying to compile that program.
 
Old 10-23-2012, 06:47 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
so javac isn't on your PATH then, or it's been uninstalled. What JDK were you using, and how was it installed?

Try "rpm -qa | grep -i jdk" and see if that gives you a package
 
Old 10-23-2012, 06:50 AM   #5
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
i am using java 1.7
after using "rpm -qa | grep -i jdk" it gives
jdk-1.7.0_07-fcs.x86_64
java-1.7.0-openjdk-1.7.0.9-2.3.3.fc17.x86_64

Last edited by amitshree; 10-23-2012 at 06:53 AM.
 
Old 10-23-2012, 06:58 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
right so presumably "rpm -qf jdk-1.7.0_07-fcs.x86_64" will list all the files including the location of javac, which woul dneed to be put onto your path
 
Old 10-23-2012, 07:05 AM   #7
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
but rpm -qf jdk-1.7.0_07-fcs.x86_64 gives
error: file /home/amit/jdk-1.7.0_07-fcs.x86_64: No such file or directory

Last edited by amitshree; 10-23-2012 at 07:11 AM.
 
Old 10-23-2012, 07:11 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Sorry, I meant -ql not -qf
 
Old 10-23-2012, 11:08 AM   #9
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
it gives a lot of lines of code..i don't know which is the path ...at last it gives
/usr/java/jdk1.7.0_07/sample/webservices/EbayServer/src/ebay/server/Main.java
/usr/java/jdk1.7.0_07/src.zip
is the last line is the path??how to set the path??
 
Old 10-23-2012, 11:42 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Setting up jdk-1.7.0_07-fcs :

1) su

2)
/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_07/jre/bin/java 2

3) /sbin/alternatives --config java
... And then select "jdk7".

.
 
Old 10-23-2012, 11:49 AM   #11
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
yeah it gives

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
+ 2 /usr/java/jdk1.7.0_07/jre/bin/java

Enter to keep the current selection[+], or type selection number: 2

is my path set??still i am able to compile programs
 
Old 10-23-2012, 11:57 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Well, usually the shown "/sbin/alternatives --install "
will take care of the javac command too.

Please try :
/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_07/bin/javac 2



.

Last edited by knudfl; 10-24-2012 at 03:37 AM.
 
Old 10-23-2012, 12:08 PM   #13
amitshree
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
yeah that worked....thanks a lot to acid kewpie & knudfl
 
  


Reply

Tags
jdk7



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
bash: javac: command not found??? MRAB54 Linux - Newbie 6 02-18-2015 08:18 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
javac: command not found ubuntu5.10 j2sdk1.4.2 trisquel Linux - Software 4 01-29-2006 07:19 PM
-bash-- javac command not found nedian123 Programming 1 06-28-2004 04:16 PM
J2sdk problem Javac command not found CollestonPie13 Linux - Software 3 02-15-2004 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:27 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
Open Source Consulting | Domain Registration