DIGIT-ARC read-only archive · snapshot: July 23, 2026

java in linux

15 posts · originally from https://geek.digit.in/community/threads/java-in-linux.46242/

Vivek788
Vivek788 Original post #1
Jan 12, 2007 at 10:40 PM
wat is the java compiler name for linux?wat commad can i use to compile and run java progs?
M
Jan 12, 2007 at 10:55 PM
Re: java i linux

Which java have you installed and how?
subratabera
Jan 12, 2007 at 11:30 PM
Re: java i linux

AFAIK Java is same on any platform and uses the same command set to compile and run java programs...

Install JDK on your system and use it as you use it on Windows...
Vivek788
Jan 13, 2007 at 9:39 AM
Re: java i linux

i have to install?
I thought fc6 comes with java compiler...
JGuru
JGuru #5
Jan 13, 2007 at 1:12 PM
@Vivek788, You must install Sun's Java JDK 6.0. Get it from here
Select JDK 6.0 Click on the "Download" button.
For Full instructions of Installing Java in Linux Click here

After you have installed the Java JDK RPM. You need to follow these steps:

Open the Terminal Window & type:

$ su -
(Enter root password)

# gedit /etc/profile.d/java.sh
Add the following line at the end of the file

Code:
    export JAVA_HOME=/usr/java/jdk1.6.0
    export PATH=$JAVA_HOME/bin:$PATH

Save the file.

Now logout & login again to see the changes.

To compile a Java File:

$ Javac FileName.java


To Run a Java Program:

$ java FileName
~Phenom~
Jan 13, 2007 at 6:16 PM
^^just a correction , the last line should be
$java classname

this is the class having main function. The filename and classname may not be same.
JGuru
JGuru #7
Jan 14, 2007 at 12:27 PM
@Phenom, As per Sun's JAVA Language design, a Class having the main() function, must
be the name of the File!!! You can't specify any filename like in C/C++!!!
So I said "Java FileName" (To make things simpler for him).
Actually it's "Java classname".
~Phenom~
Jan 14, 2007 at 12:44 PM
^^well , its the convention and not rule. It is strictly followed by already made classes in java but it is optional in user made programs.
nitish_mythology
Jan 15, 2007 at 4:04 PM
Recently I installed fc6...
I did a custom install and selected developer's tools too.
I tried to compile and exectute Java program on Eclipse and I was successful!

The only prb is tht my pc is old so eclipse was jst tooooooooo slow!
M
mehulved #10
Jan 15, 2007 at 4:25 PM
Distros like FC and Suse mostly give a java compiler bundled in too. If you do full install then mostly these tools are installed. It actually depends on the distro.
And nitish is it sun-java or gcj?
nitish why don't you try something that's light? You have a nice excuse to learn emacs. It will be light on resources. It does have a big learning curve though as I have heard. But you can try xemacs + jdee.
You can also use kate, but it is not an IDE just an editor with syntax highlighting.
JGuru
JGuru #11
Jan 15, 2007 at 5:44 PM
@Nitish, Use NetBeans IDE 5.0 BlueJ Edition. It's a very good Java IDE for School
students, who are learning Java. It's easy to use, also it uses very less RAM!!
Download it from here
Also read Tutorial on using NetBeans IDE 5.0 BlueJ Edition Click here
Also you must install Sun's Java JDK1.6.0. & not gcj (like @Mehul said).
Fedora Core 6 ships will gcj , not Sun's JDK!!!
nitish_mythology
Jan 17, 2007 at 3:35 PM
Well,As soon as I gt Linux installed in my computer's lab I wll try it!

Well In my home I was using SUN Java Eclipse IDE!
Vivek788
Vivek788 #13
Jan 17, 2007 at 7:30 PM
so u mean i already have gcj but i need to install java SDK 6.0?why?
What is difference?
M
mehulved #14
Jan 17, 2007 at 7:51 PM
Features and Limitations of GCJ

GCJ is not only a compiler. It is intended to be a complete Java environment with features similar to Sun's JDK. If you specify the -C option to gcj it will compile to standard .class files. Specifically, the goal is that gcj -C should be a plugin replacement for Sun's javac command.

GCJ comes with a bytecode interpreter (contributed by Kresten Krab Thorup) and has a fully functional ClassLoader. The standalone gij program works as a plugin replacement for Sun's java command.

GCJ works with libgcj, which is included in GCC 3.0. This runtime library includes the core runtime support, Hans Boehm's well-regarded conservative garbage collector, the bytecode interpreter and a large library of classes. For legal and technical reasons, GCJ cannot ship Sun's class library, so it has its own. The GNU Classpath Project now uses the same license and FSF copyright that libgcj and libstdc++ use, and classes are being merged between the two projects. We use the GPL but with the special exception that if you link libgcj with other files to produce an executable, this does not by itself cause the executable to be compiled by the GPL. Thus, even proprietary programs can be linked with the standard C++ or Java; runtime libraries.

The libgcj library includes most of the standard Java classes needed to run non-GUI applications, including all or most of the classes in the java.lang, java.io, java.util, java.net, java.security, java.sql and java.math packages. The major missing components are classes for doing graphics using AWT or Swing. Most of the higher-level AWT classes are implemented, but the lower-level peer classes are not complete enough to be useful. Volunteers are needed to help out.
Read it here *www.linuxjournal.com/comment/reply/4860
Vivek788
Vivek788 #15
Feb 8, 2007 at 5:29 AM
Now i instaled debian and opensuse..i get java in the former but no in the latter.Unable to find pack frm dvd and on typing yast nothign happens...