• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting path in linux

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Space pants. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic