java in linux

Status
Not open for further replies.

subratabera

Just another linux lover.
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...
 

JGuru

Wise Old Owl
@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
 
Last edited:

~Phenom~

The No.1 Stupid
^^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

Wise Old Owl
@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~

The No.1 Stupid
^^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

OSS Enthusiast!
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!
 

mehulved

18 Till I Die............
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

Wise Old Owl
@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!!!
 

mehulved

18 Till I Die............
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
 
OP
Vivek788

Vivek788

In the zone
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...
 
Status
Not open for further replies.
Top Bottom