1

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

Zanna
  • 70,465

2 Answers2

2

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

javac filename.java

To run the generated class file, use

java filename

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?.

iamgr007
  • 132
2

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

java -version

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

Or openjdk-8-jdk if you plan to do any development.

You can launch java applications from the terminal by calling java, for example:

  • a .class file such as myjavathing.class would be run with java myjavathing
  • for a .jar for example cookie.jar use the -jar option: 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!

Zanna
  • 70,465