How to Compile Java Programs in openSUSE?

Hi I am Using openSUSE 11.2 KDE in my Laptop.How to I Compile Java programs using the Konsole.I believe JDK is Installed in my System As i Checked Using the YaST and it showed me JDK already installed in the System.So can some one tell me the Commands to Compile Java Programs.
Thank You:)

Hello nivekz,

You need to run this command:

javac <Files>

So if you’ve got a file named Test.java.
Then this is the command to compile:

javac Test.java

If everything is compiled correctly then you’ll have a Test.class file in the same directory as your .java file.
To run your Test.class run this command:

java Test

Good luck!:wink:

Yes bro,This was the Step I used to follow in redhat Enterprise Linux.But some Error appears such there is no command as javac.


If 'javac' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf javac

an ‘zypper se jdk’
should show something like

i | java-1_6_0-openjdk | Java runtime environment based on OpenJDK 6 and IcedTea 6 | Paket

if you has the leading i so it is installed to your system and there should be an javac
i f you dont have the leading i you should install it via

zypper in java-1_6_0-openjdk

if you have the i an it doesnt work i would try an

zypper rm java-1_6_0-openjdk (to remove it)
zypper in java-1_6_0-openjdk (to install it again)

You’ll want to install the developer environment, i.e. java-1_7_0-openjdk-devel for Java version 7, etc. That worked for me.

Many ways to compile,
Probably the most popular Java compiler is ant, and is the usual requirement in an Ecplipe IDE.

TSU