LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2006, 03:47 AM   #1
ragux
LQ Newbie
 
Registered: Feb 2006
Distribution: fedora2, suse
Posts: 14

Rep: Reputation: 0
how to run java with IDE


hi friends
i have instlled fedora2(all package)
and also installed sun java(jdk ,j2re)
when i compile the program the IDE editor said javac command not found
what will i do?
 
Old 02-17-2006, 03:54 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
When posting can you use black or dark colors. Blue on blue is difficult to see for some of us. You need to put java in your path. In which directory is java installed on your system?
 
Old 02-17-2006, 04:20 AM   #3
ragux
LQ Newbie
 
Registered: Feb 2006
Distribution: fedora2, suse
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by reddazz
When posting can you use black or dark colors. Blue on blue is difficult to see for some of us. You need to put java in your path. In which directory is java installed on your system?

ok reddazz
thanks for u r advice and soryy for the inconvenient
 
Old 02-17-2006, 06:50 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
Originally Posted by ragux
ok reddazz
thanks for u r advice and soryy for the inconvenient
You didn't provide more info about where java is installed. Did you manage to put it in your path?
 
Old 02-17-2006, 07:17 AM   #5
HalkEkmek
LQ Newbie
 
Registered: Sep 2005
Location: Turkey
Distribution: ubuntu
Posts: 11

Rep: Reputation: 0
You must add some text to your .BASHRC file. Here is mine
The text "/opt/jdk1.5.0_04" below is MY jdk path. Write yours.

export PATH=/opt/jdk1.5.0_04/bin:$PATH
export JAVA_HOME="/opt/jdk1.5.0_04"
export CLASSPATH=.:/opt/jdk1.5.0_04
 
Old 02-17-2006, 08:28 AM   #6
byen
Member
 
Registered: Feb 2005
Location: detroit,USA
Distribution: Ubuntu
Posts: 54

Rep: Reputation: 15
ok... I dont want to take over this thread but I have a similar problem too
I also get the javac command not found. Here is what my system says

Quote:
There are 4 alternatives which provide `java'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.0
+ 2 /usr/lib/jvm/java-gcj/bin/java
3 /usr/local/jre1.5.0_06/bin/java
* 4 /usr/lib/j2re1.5-sun/bin/java
How should I proceed. Thank you.
 
Old 02-17-2006, 08:58 PM   #7
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
Code:
sudo update-alternatives --config java
 
Old 02-18-2006, 01:19 PM   #8
byen
Member
 
Registered: Feb 2005
Location: detroit,USA
Distribution: Ubuntu
Posts: 54

Rep: Reputation: 15
mrcheecks. I have already used that code to get the output that I have posted in my previous post. I have tried changing the options but it doesnt seem to work.
Does anyone know what I am doing wrong :-(
 
Old 02-19-2006, 01:01 PM   #9
Joseph Schiller
Member
 
Registered: Oct 2003
Location: New Jersey
Posts: 44

Rep: Reputation: 15
It's a difficult question, what went wrong there. You will need to retrace your steps with a 'dry run' not installing anything. It seems odd that you have java in /opt directory. It sounds like you are trying to run java 2 and java 5 at the same time. It doesn't really matter where it resides, but there are many scripts that look for it and the libraries in the usual place /usr. Unless you tell these scripts explicitly where to look, you will get unpredictable behavior. Note, not all scripts have sanity checks examining the PATH or JAVA_HOME variables before running. If they don't find the components they just quit.

On my SuSE 10 I have both java 2 and java 5 alongside each other. I don't know if fedora runs config scripts after all hardware is configured. On my system the environment settings are configured by scripts in /etc/profile.d/ directory. You can add customized scripts for different circumstances and only set the 'executable' bit when you need it. For example, I have Eclipse in my /home/Eclipse/eclipse directory, so I need to export every time I want to run it, here's an example

#!/bin/bash
#
# /etc/profile.d/eclipse_home.sh
#
# This script sets PATH variable to accomodate Eclipse.

if [ -x /home/Eclipse/eclipse ] ; then
export PATH=$PATH:/home/Eclipse/eclipse
fi

# This file was created by joe on 06/11/2005
# and appended to the /etc/profile.d directory.

Here's another example that configures "alljava". It's a bit redundant, setting and unsetting different variables, but maybe it will help you.

#
# /etc/profile.d/alljava.sh
#
# send feedback to http://www.suse.de/feedback

#
# This script sets some environment variables for default java.
# Affected variables: PATH, JAVA_BINDIR, JAVA_HOME, JRE_HOME,
# JDK_HOME, SDK_HOME
#

__libdir=lib
if [ -x /usr/lib64/jvm/java ] || [ -x /usr/lib64/jvm/jre ] ; then
__libdir=lib64
fi

if [ -x /usr/$__libdir/jvm/java/bin/java ] || [ -x /usr/$__libdir/jvm/java/bin/jre ] ; then
export JAVA_BINDIR=/usr/$__libdir/jvm/java/bin
export JAVA_ROOT=/usr/$__libdir/jvm/java
export JAVA_HOME=/usr/$__libdir/jvm/java
if [ -x /usr/$__libdir/jvm/java/jre/bin/java ] ; then
export JRE_HOME=/usr/$__libdir/jvm/java/jre
else
export JRE_HOME=/usr/$__libdir/jvm/java
fi
unset JDK_HOME
unset SDK_HOME
if [ -x /usr/$__libdir/jvm/java/bin/javac ] ; then
# it is development kit
if [ -x /usr/$__libdir/jvm/java/bin/jre ] ; then
export JDK_HOME=/usr/$__libdir/jvm/java
else
export JDK_HOME=/usr/$__libdir/jvm/java
export SDK_HOME=/usr/$__libdir/jvm/java
fi
fi
else
if [ -x /usr/$__libdir/jvm/jre/bin/java ] ; then
# it is IBMJava2-JRE or SunJava2-JRE
export PATH=$PATH:/usr/$__libdir/jvm/jre/bin
export JAVA_BINDIR=/usr/$__libdir/jvm/jre/bin
export JAVA_ROOT=/usr/$__libdir/jvm/jre
export JAVA_HOME=/usr/$__libdir/jvm/jre
export JRE_HOME=/usr/$__libdir/jvm/jre
unset JDK_HOME
unset SDK_HOME
fi
fi

unset __libdir

Last edited by Joseph Schiller; 02-19-2006 at 01:04 PM.
 
Old 02-19-2006, 01:09 PM   #10
Joseph Schiller
Member
 
Registered: Oct 2003
Location: New Jersey
Posts: 44

Rep: Reputation: 15
Allmost forgot, you need SDK if you want javac, jre is only a runtime environment.
 
  


Reply



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
which IDE to use for java ? calang Programming 3 10-02-2005 03:49 PM
java ide demmylls Programming 5 06-10-2004 12:53 AM
IDE for java senthilasks Linux - Software 10 11-08-2003 12:48 PM
Java IDE and C IDE Eros_ Linux - Software 2 07-23-2003 02:21 PM
Java applets run fine in Konqueror, but won't run in MS IE. OAnimal Linux - Software 7 12-04-2002 06:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:23 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration