This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java in linux

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have downloaded jdk-6u10-ea-bin-b09-linux-i586-19_dec_2007 in my linux machine and installed as per the installation instructions.Now it is installed in the path /usr/java/jdk1.6.0_10.javac ,java are all inside the bin.but when i try to run the javac in the console,it displays the error:
-bash: javac: command not found.what is wrong here.

Thanks
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do this:
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by preethi Ayyappan:
Hi,
i have downloaded jdk-6u10-ea-bin-b09-linux-i586-19_dec_2007 in my linux machine and installed as per the installation instructions.Now it is installed in the path /usr/java/jdk1.6.0_10.javac ,java are all inside the bin.but when i try to run the javac in the console,it displays the error:
-bash: javac: command not found.what is wrong here.

Thanks


You have to set your Path environment to show where you have installed java.
If you use bash as your shell, then you would add the following line to the end of your .bashrc: export PATH=/path/to/java:$PATH

Here replace that path/to/java with the directory structure you have used
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.I set the path like this:
[root@asterisk1 ~]# export PATH=/usr/java/jdk1.6.0_10/bin:$PATH

its working.But if i try to compile a program which is in the path /usr/java/jdk1.6.0_10/bin,its not compiling.it displays the message

javac: file not found: HelloAGIScript.java
Usage: javac <options> <source files>
use -help for a list of possible options
.
my path is correct? or i have to put $ infront of export?
[ January 09, 2008: Message edited by: preethi Ayyappan ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac: file not found: HelloAGIScript.java
Usage: javac <options> <source files>
use -help for a list of possible options

Your path is correct now, but the file HelloAGIScript.java does not exist in the directory where you're running this.

Note that Linux is case-sensitive (Windows is not); so if the file is called helloAGIScript.java, for example, then that's not the same as HelloAGIScript.java.

Make sure you execute the command in the right directory and that you use the correct name for the source file.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks bala.i have done that. now javac is working.but when i try to run the java file which is in the same path ,it displays the message:

javac: file not found: HelloAGIScript.java
Usage: javac <options> <source files>
use -help for a list of possible options
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.Now my file is compiling
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,I had given like this.It was compiled well.

[root@asterisk1 ~]#export PATH=/usr/java/jdk1.6.0_10/bin:$PATH
.
But every time when i open the new console it is not working.it is working only after i export path every time i open the console.Am i doing wrong?

Thanks.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add the "export PATH..." line to your .profile file in your user directory.
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by preethi Ayyappan:
Hi,I had given like this.It was compiled well.
.
But every time when i open the new console it is not working.it is working only after i export path every time i open the console.Am i doing wrong?

Thanks.


If you want this to be permanent for your userid, then add these lines to your:
$HOME/.profile if you are a ksh or sh user
$HOME/.bashrc if you are a bash user
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic