Also if I need one then which IDE should I go for and which package (most probably eclipse)?
My system: HP pavillion g6-1200TU with 2 GB Ram,64 bit,Intel Core i3-2330M with 2.2 ghz, with Intel HD graphics 3000, 500gb HDD
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Eclipse IDE is quite heavy for i3 processor with 2GB RAM and not recommended unless you need to use the project explorer and stuff. If you have to install eclipse, follow this
else if you've simple programs:
To compile the file, open your terminal and type
To run the generated class file, use
But to do this you need to have the Java JDK installed in your computer. You can install it with the instructions in How do I install Java?.
No, you do not need an IDE to run Java programs. For that you need only a JRE (Java Runtime Environment) - this provides both a JVM (Java Virtual Machine) that enables the system to run Java programs, and a Java Class Library (the set of dynamic libraries used by java programs at run time).
You can check that you have a JRE by typing
This will show you a JRE if you have one; if not, then you should install a package, for example
sudo apt install openjdk-8-jre
openjdk-8-jdk if you plan to do any development.
You can launch java applications from the terminal by calling
java, for example:
.classfile such as
myjavathing.classwould be run with
java -jar cookie.jar
If a Java program fails to run, this is usually because some additional libraries need to be installed. Searching for the error message you get on Stack Overflow usually helps you discover which package you need to install to provide the missing libraries!