Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 22nd November 2004, 05:01 PM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
Java 5.0 SDK setup, help please

I'm having probelms with the setup of J2SE, please some assistance would be appreciated

I have two entries in my path for the java bin, but still cannot run java from any folder?

I don't know how to set the links for javac as described in other posts?

Precodeure

# rpm -iv jdk-1_5_0-linux-i586.rpm

# rpm -e jdkgcj
... package not installed ...

# java -version
... placeholder message ...

/etc/profile.d/java.sh file created with single line
export PATH=$PATH:/usr/java/jdk*/bin

#source /etc/profile.d/java.sh
... verified path update ...

# alternatives --remove java /usr/share/java/libgcj-java-placeholder.sh

# alternatives --remove javac /usr/share/java/libgcj-javac-placeholder.sh
... has not been configured as an alternative for javac ...

# alternatives --remove jar /usr/bin/fastjar

# alternatives --remove jar.1.gz /usr/share/man/man1/fastjar.1.gz

# cd /usr/bin

# ln -s /usr/java/jre1.5.0/bin/java java

... don't know how to set the links for javac ??? ...

# java
bash: java: command not found

# /usr/java/jdk1.5.0/bin/java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

# set
PATH='/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/java/jdk*/bin/:/root/bin:/usr/java/jdk*/bin/'
Reply With Quote
  #2  
Old 22nd November 2004, 05:38 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
It looks like you have installed BOTH the Java runtime environment, and the Java Developers kit and are getting the two mixed up.

Try setting these two environment variables.
export PATH=$PATH:/usr/java/jdk1.5.0/bin
export JAVA_HOME= /usr/java/jdk1.5.0

if you want a link to the javac binary in /usr/local say
then do this
"cd /usr/local"
"ln /usr/java/jdk1.5.0/bin/javac ."
"ln /usr/java/jdk1.5.0/bin/java ."

You probably need BOTH links, one to compile java source (javac), and one to actually run the java code (java)
Reply With Quote
  #3  
Old 22nd November 2004, 05:40 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
Typoe in previous post, just as soon as I hit the post button I saw it.

"cd /usr/local/bin" (NOT "cd /usr/local")
"ln /usr/java/jdk1.5.0/bin/javac ."
"ln /usr/java/jdk1.5.0/bin/java ."
Reply With Quote
  #4  
Old 22nd November 2004, 05:53 PM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
Yes I'm wanting to setup the development and runtime environments

To set the environment variables, is using 'etc/profile.d/java.sh' the best way to do this?
Reply With Quote
  #5  
Old 22nd November 2004, 05:59 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
Personally, I just put the two lines

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

in my "/etc/profile" file
Reply With Quote
  #6  
Old 22nd November 2004, 06:01 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
By the way, you do NOT need to make the links in "/usr/local" IF you put the "export PATH=$PATH:/usr/java/jdk1.5.0/bin" in your "/etc/profile"...

I would actually recommend NOT using links, because if you upgrade your java compiler in the future, the links to the old version can cause problems....
Reply With Quote
  #7  
Old 22nd November 2004, 06:12 PM
crackers's Avatar
crackers Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Seattle, WA, USA
Age: 56
Posts: 3,423
You don't need to install both the SDK and the JRE - the SDK comes with the JRE in a separate binary directory (/path/to/sdk/jre/bin). In fact, you might actually confuse some applications and IDE's if you install both and put both in the path.

What I've done in the past is install the tarballs in /opt, create a soft-link (ln -s /opt/j2sdk1.4.2_04 /opt/java) and added the following to the /etc/profile file:
Code:
pathmunge /usr/X11R6/bin after

# this is the new stuff
pathmunge /opt/java after
export JAVA_HOME=/opt/java
# end of new stuff

unset pathmunge
This allows you to reset the basic SDK softlink as needed. Alterntatively (pun intented), I got the alternatives stuff figured out at http://fedoraforum.org/forum/showpos...6&postcount=10
__________________
Linux User #28251 (April '93)
Professional Java Geek :cool:
Reply With Quote
  #8  
Old 22nd November 2004, 06:48 PM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
If I put the path and home statements in the '/etc/profile' then I won't need to have a '/etc/profile.d/java.sh' ?

Also, the linking thing is confusing me a little, I have checked the directory structure and can see that the JRE java file is located in both the /usr/java/jdk1.5.0/bin and /usr/java/jdk1.5.0/jre/bin directories, any suggestions about that ?

Once i have java and javac working, then I will want to install and configure a good java editor, i'm a little unsure about moving to an IDE at this stage?
Reply With Quote
  #9  
Old 22nd November 2004, 07:27 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
If you use windows, then just think if "linking" as "creating a shortcut"....They are pretty much the same thing....

The "jre" subdirectory is the "Runtime" version for java. the binaries/programs for java. it doesn't include a compiler (no javac in the "jre/bin" subdirectory...)

If you stick with the "PATH and CLASSPATH" environment variables that I showed earlier, you should be okay....

PS: a good java editor/development platform is "eclipse" available from http://www.eclipse.org/
Reply With Quote
  #10  
Old 22nd November 2004, 07:28 PM
james_in_denver Offline
Registered User
 
Join Date: Oct 2004
Posts: 1,227
If I put the path and home statements in the '/etc/profile' then I won't need to have a '/etc/profile.d/java.sh' ?

Correct...
Reply With Quote
  #11  
Old 22nd November 2004, 08:39 PM
crackers's Avatar
crackers Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Seattle, WA, USA
Age: 56
Posts: 3,423
Quote:
Originally Posted by james_in_denver
If you stick with the "PATH and CLASSPATH" environment variables that I showed earlier, you should be okay....
Er, didn't you mean JAVA_HOME? Setting a "global" CLASSPATH is more likely to give you problems (especially when using multiple libraries).

Quote:
PS: a good java editor/development platform is "eclipse" available from http://www.eclipse.org/
Seconded - the only "better" one is IDEA, but the price for Eclipse is pretty hard to beat. Don't get the MOTIF packages though - at least the GTK version looks like it was built in the last decade.
__________________
Linux User #28251 (April '93)
Professional Java Geek :cool:
Reply With Quote
  #12  
Old 23rd November 2004, 04:55 AM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
Hi All,

thank you all for the help so far, java is executing from the command line correctly after adding the PATH and JAVA_HOME environment variables to 'etc/profile'

however, I am still having the script placeholder execute for javac, please any suggestions how to resolve ?

[root@localhost /]# javac
libgcj-javac-placeholder.sh

This script is a placeholder for the /usr/bin/javac
master link required by jpackage.org conventions. libgcj's
rmiregistry, rmic and jar tools are now slave symlinks to these
masters, and are managed by the alternatives(8) system.

This change was necessary because the rmiregistry, rmic and jar tools
installed by previous versions of libgcj conflicted with symlinks
installed by jpackage.org JVM packages.
gcj: no input files
Reply With Quote
  #13  
Old 23rd November 2004, 05:05 AM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
I just executed this command again, but this time without message:

# alternatives --remove javac /usr/share/java/libgcj-javac-placeholder.sh

# javac
bash: /usr/bin/javac: No such file or directory

Er, yet again any suggestions?
Reply With Quote
  #14  
Old 23rd November 2004, 06:29 AM
crackers's Avatar
crackers Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Seattle, WA, USA
Age: 56
Posts: 3,423
Try removing GCJ - "rpm -e gcj" should do it.
__________________
Linux User #28251 (April '93)
Professional Java Geek :cool:
Reply With Quote
  #15  
Old 23rd November 2004, 05:41 PM
elvenkind Offline
Registered User
 
Join Date: Nov 2004
Posts: 24
Cool,

Javac is now working, thanks for all the help and advice, talk soon....
Reply With Quote
Reply

Tags
java, sdk, setup

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to setup Java on Fedora 8 - test 1 Gul Dukat Using Fedora 3 22nd August 2007 06:19 AM
How to setup azureus in FC6 using Sun's implementation of Java d347hm4n Guides & Solutions (No Questions) 0 16th January 2007 01:51 PM
Dvico Fusion HDTV initial setup and Mythtv Setup holden-nut Using Fedora 3 18th November 2006 05:33 AM
ant / java setup problem lazlow Using Fedora 1 17th February 2006 04:23 PM


Current GMT-time: 12:32 (Tuesday, 21-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat