Find the answer to your Linux question:
Results 1 to 9 of 9
Hi, I am using Fedora core 5 32+ bit as my os on the pc. I want to learn Java a bit on my own. Can I compile Java code ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Sep 2006
    Posts
    175

    Compiling Java in a terminal


    Hi,

    I am using Fedora core 5 32+ bit as my os on the pc. I want to learn Java a bit on my own. Can I compile Java code from the terminal itself? I am not used to any particular IDE at the moment so terminal seems to be the best way forward as I have been doing this with my sample C++ codes as well. I would appreciate any further guidance in terms of what is the best way to start programming in Java on Fedora platform. Thanks a lot gentlemen.

  2. #2
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    Yes you can do it,you should have jdk and jre installed once you make your source code type :
    javac Welcome.java
    java Welcome (to run the program) not that it's the name of the main class.

    hope this help

  3. #3
    Linux Newbie
    Join Date
    Sep 2006
    Posts
    175
    Quote Originally Posted by aliov View Post
    Yes you can do it,you should have jdk and jre installed once you make your source code type :
    javac Welcome.java
    java Welcome (to run the program) not that it's the name of the main class.

    hope this help
    Hi,

    Thanks a lot what I did first was

    [root@localhost ~]# rpm -qi java
    package java is not installed


    This means Java is not installed on the system, so this what I did next in order to get the Fedora version of Java (if I am wrong do correct me here please)


    root@localhost ~]# yum install java
    Loading "installonlyn" plugin
    Setting up Install Process
    Setting up repositories
    dries [1/6]
    core [2/6]
    updates [3/6]
    freshrpms [4/6]
    macromedia [5/6]
    extras [6/6]
    Reading repository metadata in from local files
    Parsing package install arguments
    Nothing to do


    This is what I do not understand as to what actually happened here, did it install Java or not? Then I tried this

    [root@localhost ~]# alternatives --config java

    There are 2 programs which provide 'java'.

    Selection Command
    -----------------------------------------------
    *+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
    2 /pathto/sunjava/java

    Enter to keep the current selection[+], or type selection number: 2


    Now please tell me do I still need to install JRE etc in order to make Java run on my pc? If yes then I am struggling to get hold of a decent installation guide that is easy for me to understand which is more Core 5 centric. Thanks for your patience.

  4. #4
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    Yes you need to install jre and that's it , sure install it like what you did for jdk.

    Cheers

  5. #5
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    Go to sun's website, download jre for linux, compile and make install.

    Thats what I did.

  6. #6
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    Yes this will work also, but if there is a possibility to use a compiled onces so what it the idea to compile it.

  7. #7
    Linux Newbie
    Join Date
    Sep 2006
    Posts
    175
    Quote Originally Posted by aliov View Post
    Yes you need to install jre and that's it , sure install it like what you did for jdk.

    Cheers
    Thanks, so all I only need to install jre not jdk right? Here is the page where I went to in order to get jre, but it seems like there is now a latest version of jre called jre-6u1-linux-i586-rpm.bin and the one I downloaded was

    Linux RPM (self-extracting file) filesize: 17.67 MB


    Download Java software for Linux from Sun Microsystems

    Have I done every thing right so far?

  8. #8
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    No, probably you'll need the JDK (JavaSE Development Kit) wish contains additional binaries, libraries.

  9. #9
    Linux Newbie
    Join Date
    Sep 2006
    Posts
    175
    Quote Originally Posted by aliov View Post
    No, probably you'll need the JDK (JavaSE Development Kit) wish contains additional binaries, libraries.
    Thanks,

    looks like Sun website is under maintenance at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •