Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description here

Trying to set up a path for the terminal. I already have Eclipse running great. Dual os between windows 7 and Ubuntu 12.04. However, I would prefer to run everything out of Ubuntu, just not very experienced and all the forums I have searched are not giving me the step by step answers I need to make this happen. I included a screen shot of some information about my version etc. Any help would be greatly appreciated at this point I've put 10+ hours into this and this is my last resort.

share|improve this question
You need to more clearly explain what it is you are trying to do. It looks like both javac and java are in your path already. Is it the wrong version of java? – pestilence Jun 7 '12 at 18:05
i think they mean the path to 'HelloWorld'. Xsteen, try using /path/to/the/file/to/run in place of just "HelloWorld" – Thomas Ward Jun 7 '12 at 19:08
You don't need screenshots for textinterfaces on Linux. Mark the whole text with your mouse, and paste it by middle-click (=mouse-wheel) into the edit-field. Format it with the Code-tag (<S>). Ctrl+C and Ctrl+V work too, but not Ctrl+X for submitted commands, of course. – user unknown Jun 8 '12 at 11:35

Hi actually you are not following the syntax properly .

To Compile a java file you have to do

javac and for your case that command will be javac

to Run a Java file you have to do

java filename and for your case java HelloWorld

share|improve this answer
javac HelloWorld 

is wrong in that way, that java*c* is a call for the Java*c*ompiler, and you invoke it on a Java source file, which would be in your case.

Then you can't check the version of javac by looking for java or asking java -version. Do javac -version and which javac instead.

To switch between different versions completely, you use


To switch an individual program (javac but not java or vice versa, or jar or appletviewer and so on)

update-alternatives --set java

Without the alternatives system you would change the PATH, and insert /usr/lib/jvm/java-7/bin for example, or sort it before java-1.6.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.