LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-12-2010, 10:49 AM   #1
bajaj15
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Lightbulb How to use jdk for java programming


Hi all
I would like to run java program on fedora10,but I am facing some problems .when I use which java command it show usr/bin/java directory.I was trying to set the java_home path in bash_profile,but there is no affect.Tell me how can I solve my problem?
Thanks in Advance

Last edited by bajaj15; 03-12-2010 at 10:53 AM.
 
Old 03-12-2010, 11:00 AM   #2
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 12.04 / CentOS 6.5
Posts: 384

Rep: Reputation: 61
Are you sure /usr/bin/java is a directory and not an executable?

You'd be better off downloading the official Sun JDK for Linux from their website - it's faster than the open JDK.

Anyway...either is fine.


You can add the JAVA_HOME environment variable to /etc/profile (system-wide) - but I doubt you'll need it if you're using the JDK supplied with Fedora 10. Why do you feel you need this environment variable set up?

I use the Sun JDK myself, so my /etc/profile reads as: -

export PATH=/usr/local/java/bin:$PATH
export JAVA_HOME=/usr/local/java

Compile with: - javac -cp .[:<any .jar libraries you want to include] *.java
Run with: - java -cp .[:<any .jar libraries you want to include] <Java program name>
 
Old 03-12-2010, 11:07 AM   #3
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Actually, I generally recommend that you:

1. Uninstall Gnu java
2. Download and install the Sun JDK (which includes compiler, runtime and the NetBeans IDE).

At a minimum, I would *definitely* recommend configuring Java with "alternatives":

Quote:
http://www.mjmwired.net/resources/mjm-fedora-f7.html
http://www.ja-sig.org/wiki/display/C...un+JVM+in+RHEL

[mirandam@charon ~]$ sudo /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.6/bin/java 2
[mirandam@charon ~]$ echo 2 | sudo /usr/sbin/alternatives --config java

[mirandam@charon ~]$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
<= This example shows how to configure "Sun JDK" as the default
'Hope that helps .. PSM

PS:
I completely agree with arashi256: the Sun JDK is definitely the right choice. For many different reasons...

Last edited by paulsm4; 03-12-2010 at 11:09 AM.
 
  


Reply

Tags
java


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java JDK idgeitman Linux - Newbie 4 01-21-2010 02:53 PM
Help installing the Java JDK CS_Student_DrewU Programming 2 07-14-2007 10:43 PM
How do I install java jdk 1.5 on RHEL? daveb1040 Linux - Software 2 12-23-2006 04:23 AM
compile java JDK 1.4 kernelvn *BSD 2 06-21-2005 09:42 PM


All times are GMT -5. The time now is 12:33 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration