Jump to content

Saving Aliases? Or The Lazy Typist


Recommended Posts

The good news is, I 'accidentally' installed the JDK package from an rpm bin. Woot.

Now that its all unpacked and in place though, Im having a helluva time bringing up javac on command line. I have to type the whole /user/java/jdk.....followed with version numbers then /bin. then javac. An alias works. For one session. When I edited the .bashrc script to include the alias , nothing happened. A tip in one of the docs said to add it to the end of the bash startup script. Nothing.

 

Apart from being new, am I that far off from getting a simple javac command to invoke the compiler? Is there an easier way to either call up the javac compiler or to shorten the path/command needed to do so?

 

Btw, being new is fun. You have no idea if you have any idea of what youre supposed to have an idea about. Or not... :screwy:

 

[moved from Software by spinynorman]

Link to comment
Share on other sites

How did you define your alias? In .bashrc it should be OK.

Also, sometimes an alias is not enough, and you have to write a script, or at least a function. We'll see...

 

Yves.

 

Btw, I agree :) I'm not new anymore, though...

Link to comment
Share on other sites

I thought I had edited and added the alias to .bashrc, but then nothing happened afterwards. alias javac=/usr/java......etc, etc. edited onto the end of the .bashrc script. Is there a simpler way, or another way of making an alias permanent or making another simpler link to javac? I saw a similar post recently but cant remember where about having to set the path for javac.

 

PS I figure the rate at which Linux moves forward, I ll probably be new till Im dead, and with my luck Heaven will be running Solaris...

Link to comment
Share on other sites

try to add the "/user/java/jdk.....followed with version numbers then /bin" in your local PATH at .bash_profile .. edit .bash_profile then....edit the line that contains PATH

ex. PATH=$PATH:$HOME/bin:/usr/local:/usr/local/bin (original)

make it PATH=$PATH:$HOME/bin:/usr/local:/usr/local/bin:/$HOME/java/jdk-xxx/bin

Link to comment
Share on other sites

Can you show us the alias line you added to your ~/.bashrc ?

 

Did you remember to source the ~/.bashrc if you're still using the same terminal session?

 

If you're a lazy typist don't forget you can use tab complete for path names in bash.

Link to comment
Share on other sites

well, if memory serves...

 

alias javac = /usr/java etc...

 

then saved the change and exited.....

 

Im sure its missing something... im at the stage of newbness where I can accidentally install and compile and configure on command line but cant tell you how I did it. In this past week I accidentally installed Java DK, Lost Labyrinth to another place which requires me to cd to its directory , then it messes up my resolution when i exit, made three coasters trying to burn a DSL iso (thank god for K2b....death to XP!) and...you get the idea. Btw...sometimes the tab complete works and sometimes the cursor just blinks and nothing completes...but now Im cutting and pasting paths more than I used to. Feels like cheating...:-)

Link to comment
Share on other sites

You normally put aliases in your .bashrc file which is a hidden file located in your home/<username> directory. In your case you should add this line to .bashrc:

 

alias javac='/usr/java/whatever/whatever'

 

Don't forget to put the single quotes(') around the defined alias as per the above. The alias will not take effect until you reboot IIRC.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...