Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2004

Tip: Looking for answers? Try searching our database.

use java and co by its name

Thread view: 
drdoubt - 08 Mar 2004 13:15 GMT
I have j2sdk for linux. I am not able to execute javac, java and
others by their names. To execute them, I need to do ./javac to
compile the program. Can't I execute them just by using their names.

regards,
vz.
Erwin Moller - 08 Mar 2004 14:56 GMT
> I have j2sdk for linux. I am not able to execute javac, java and
> others by their names. To execute them, I need to do ./javac to
> compile the program. Can't I execute them just by using their names.
>
> regards,
> vz.

Hi,

That is a Linux related issue, not java.
Try comp.os.linux.help to get a few pointers.

Regards,
Erwin Moller
Darryl L. Pierce - 08 Mar 2004 15:28 GMT
> I have j2sdk for linux. I am not able to execute javac, java and
> others by their names. To execute them, I need to do ./javac to
> compile the program. Can't I execute them just by using their names.

Yes, but they have to be in your *search path* for your shell to find them.
If you're using BASH, then add the following to your ~/.bashrc file:

JAVA_HOME=[the directory where you have Java installed]
PATH=$PATH:$JAVA_HOME/bin

export JAVA_HOME PATH

Signature

Darryl L. Pierce <mcpierce@myrealbox.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"

Collin VanDyck - 08 Mar 2004 18:57 GMT
> > I have j2sdk for linux. I am not able to execute javac, java and
> > others by their names. To execute them, I need to do ./javac to
[quoted text clipped - 7 lines]
>
> export JAVA_HOME PATH

Also, try adding "." to your path.  That will allow you to run progs in your
current directory.
Darryl L. Pierce - 08 Mar 2004 19:14 GMT
>> > I have j2sdk for linux. I am not able to execute javac, java and
>> > others by their names. To execute them, I need to do ./javac to
[quoted text clipped - 11 lines]
> Also, try adding "." to your path.  That will allow you to run progs in
> your current directory.

NO! BAD MOJO! Never add the current directory indicator to your search path.

Signature

Darryl L. Pierce <mcpierce@myrealbox.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"

Gregory A. Swarthout - 08 Mar 2004 23:20 GMT
> >> > I have j2sdk for linux. I am not able to execute javac, java and
> >> > others by their names. To execute them, I need to do ./javac to
[quoted text clipped - 13 lines]
>
> NO! BAD MOJO! Never add the current directory indicator to your search path.

Why?
Jon A. Cruz - 09 Mar 2004 07:12 GMT
>>>Also, try adding "." to your path.  That will allow you to run progs in
>>>your current directory.
>>
>>NO! BAD MOJO! Never add the current directory indicator to your search path.
>
> Why?

Because it's a bad thing to do.

:-)

It can hide things that are happening. It can make situations harder to
reproduce. Lot's of other things. Usually it's only Windows systems that
have "." on the executable search path.
drdoubt - 10 Mar 2004 18:10 GMT
> >>>Also, try adding "." to your path.  That will allow you to run progs in
> >>>your current directory.
[quoted text clipped - 10 lines]
> reproduce. Lot's of other things. Usually it's only Windows systems that
> have "." on the executable search path.

My job was done, thanks to Darryl L. Pierce. But I did not get why one
should not add the current directory indicator.

regards,
vz.
Darryl L. Pierce - 10 Mar 2004 17:25 GMT
>> > Also, try adding "." to your path.  That will allow you to run progs in
>> > your current directory.
[quoted text clipped - 3 lines]
>
> Why?

1. It's a Windows/DOS practice and not a recommended thing to do in *nix.
2. It opens security holes in your system in that it allows a script to
execute a file in the current directory without you *expressly* telling it
to do so.
3. Common practice on *nix is to put executables in directories named
"*/bin"; any other directory should have the path explicitly stated
4. Executing arbitrary binaries in the current directory can hide problems
on your system.

Signature

Darryl L. Pierce <mcpierce@myrealbox.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"

Collin VanDyck - 09 Mar 2004 21:03 GMT
> NO! BAD MOJO! Never add the current directory indicator to your search path.

I've never had any problem with it, personally, but it does seem to be a
common problem amongst *nix greenhorns.  Good advice :)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.