Search blog

Monday, May 9, 2016

Executing Java Program from Ubuntu Terminal

If you want to execute your java program from your terminal in Ubuntu first make sure you have installed any one of the Java packages:
  • default-jdk
  • ecj
  • gcj-4.8-jdk
  • openjdk-7-jdk
  • gcj-4.6-jdk
  • openjdk-6-jdk
To know the differences in each of the above packages, please follow this link:
    In my case I installed the first package using the following command:

     sudo apt-get install default-jdk  

    Now change your directory to the directory containing your Java Program(s). Once done hit the following command to execute your Java Program:


     java FileName  

    No comments:

    Post a Comment

    Thank you for your Feedback!

    Top 5 Posts (Weekly)