• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting path in linux

 
swapna nyathani
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to linux and i want to run java code in linux.
Am using Redhat Enterprise linux 5.
I think java is installed (i mean built in)


When i write a java code in vi editor, its syntax is recognized, example keywords are highlighted.
i know how to run.For example, if 'sample' is java file name,
> javac sample.java
> java sample
will give output.
but the error i am getting is : \bash ' javac' is not a command
i think the problem might be that path is not set.
Can anyone tell me how to set path.

Thanks,
swapna.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure that Java is built-in, but you can find out by entering:

java -version

Also, in RHEL Java is usually installed at /usr/java, you can look in there to see which one is installed.

To set PATH, open the ~/.bashrc file and add lines like this:

 
swapna nyathani
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks for your reply Peter.

As you said ' To set PATH, open the ~/.bashrc file '
i want to know where is 'bashrc' located.

And i can see that java is installed in 'root/bin/java'.

I have ' KDevelop' an IDE used for multiple languages installed in linux.
how can i run java in it.
please help.

Thanks,
Swapna.






 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you said ' To set PATH, open the ~/.bashrc file '
i want to know where is 'bashrc' located.

Um, the tilde (~) equates to your home directory, so ~/.bashrc is the location of the file. If the file does not exist, you can create it.

[code]And i can see that java is installed in 'root/bin/java'.
I assume that is a type and you mean to type "/root/bin/java".
Are you logged in as root by any chance. If so, don't do that. You should have a separate user account that you always log into. And I am also guessing that you downloaded the *.bin file, and not the *-rpm.bin file, for Sun's web site.

I have ' KDevelop' an IDE used for multiple languages installed in linux.
how can i run java in it.

I know nothing about KDevelop - I use Eclipse. Perhaps someone who uses KDevelop can help.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
swapna valupadasu wrote:
but the error i am getting is : \bash ' javac' is not a command
i think the problem might be that path is not set.
Can anyone tell me how to set path.


You should be precise when reporting errors, because sometimes a single blank makes a difference. The name of the compiler is 'javac', not ' javac', but I guess this is a reporting error.

The backslash in front of bash is surprising too.

'root/bin' looks like a misinterpretation. There is the homedirectory of root, named '/root', and there is the root of the filesystem named '/', but often simply named root too.

But javac is normally put to /usr/bin/javac, not /bin/javac by the installationprocess.

 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic