File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java in linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java in linux" Watch "java in linux" New topic
Author

java in linux

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
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

Joined: Nov 05, 2000
Posts: 761

You need to do this:


Regards,

Pho
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

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

Joined: Oct 04, 2007
Posts: 518
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

Joined: Aug 16, 2005
Posts: 14143
    
  18

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
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

Joined: Oct 04, 2007
Posts: 518
thanks.Now my file is compiling
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
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

Joined: Aug 16, 2005
Posts: 14143
    
  18

You need to add the "export PATH..." line to your .profile file in your user directory.
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

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
 
subject: java in linux