LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-25-2008, 02:06 AM   #1
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Rep: Reputation: 15
Problem with exporting environment variables in Fedora


Hello...I downloaded the software for j2sdk RI and have been trying to install it when I met this roadblock. As per the installation instructions I need to set three environment variables...J2EE_HOME, JAVA_HOME, PATH. The problem is, I set the variable using

J2EE_HOME="directory structure"
export $J2EE_HOME
When I try echoing the variable in the same terminal it prints out the value of the variable but when I open a new terminal it simply prints out a blank line...I ve been googling and understood that we perform export to make the variable global and accessible to other child processes...but somehow this is not working for me

I even tried many variants of it, like...

J2EE_HOME='directory structure'
J2EE_HOME=directory structure
export $J2EE_HOME
export J2EE_HOME
export $J2EE_HOME=directory strucure
in many different combinations but I am still stuck...please help.Any help would be most appreciated...
 
Old 05-25-2008, 02:18 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by sugantha View Post
When I try echoing the variable in the same terminal it prints out the value of the variable but when I open a new terminal it simply prints out a blank line...I ve been googling and understood that we perform export to make the variable global and accessible to other child processes...but somehow this is not working for me
That's true. But when you open a new terminal you start another process, not a child of the first one. To have the variable correctly setup every time you open a terminal, put the export statement into ~/.bashrc.
Code:
export J2EE_HOME=/path/to/directory
Every time you open a terminal, that is you open a new shell session, this file is sourced and the settings (environment variables, aliases, functions...) are globally available.
 
Old 05-25-2008, 04:59 AM   #3
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for your reply..where can I find this file /.bashrc to edit...
 
Old 05-25-2008, 05:02 AM   #4
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Original Poster
Rep: Reputation: 15
when I type vi ~/.bashrc from root(/)...I get the following

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~
where in this script should I include the line you mentioned... Thanks for your help so far.
 
Old 05-25-2008, 05:33 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Anywhere before the end of the file will do.

Quote:
Originally Posted by sugantha View Post
when I type vi ~/.bashrc from root(/)
FWIW, it does not matter from where you edit the file - the tilde (~) is simply a shorthand for your home directory.
 
Old 05-25-2008, 06:02 AM   #6
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Original Poster
Rep: Reputation: 15
Thank you very much..that worked perfectly.Though I still have problems with getting the tool to install properly, I think those are issues with the PATH variable.Will try to clear up..Thanks for your help so far...
 
Old 05-25-2008, 06:14 AM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
What specific problems are you having?
 
Old 05-25-2008, 06:16 AM   #8
Jim44
Member
 
Registered: Feb 2006
Location: Atlanta, Georgia, USA
Distribution: Mint, Ubuntu, Centos
Posts: 57

Rep: Reputation: 15
If need be, add to the path with an entry in the .bashrc file like (after JAVA_HOME is defined):

export PATH=$PATH:$JAVA_HOME/bin
 
Old 05-25-2008, 12:25 PM   #9
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Original Poster
Rep: Reputation: 15
Hello I did try and followed the installation instructions as follows...

http://java.sun.com/j2ee/sdk_1.3/install.html

I rebooted the system and as per Kathy sierra's Head first EJB, this particular server has to be started by issuing the following command

%j2ee -verbose
but I get the following output

Cannot write the seed file for fast startup. The next startup will be slow.
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at com.sun.enterprise.repository.ConfigurationImpl.getServerRepository(ConfigurationImpl.java:88)
at com.sun.enterprise.repository.ConfigurationImpl.<init>(ConfigurationImpl.java:41)
at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:175)
at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)
J2EE server listen port: 1050
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/internal/util/IdentityHashtable
at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.<clinit>(Util.java:87)
at com.sun.corba.ee.internal.POA.POAImpl.activate(POAImpl.java:935)
at com.sun.corba.ee.internal.POA.POAImpl.activate_object(POAImpl.java:895)
at com.sun.corba.ee.internal.CosNaming.TransientNameService.initialize(TransientNameService.java:117)
at com.sun.corba.ee.internal.CosNaming.TransientNameService.<init>(TransientNameService.java:70)
at com.sun.enterprise.iiop.POAProtocolMgr.initializeNaming(POAProtocolMgr.java:103)
at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:226)
at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)
Caused by: java.lang.ClassNotFoundException: com.sun.corba.se.internal.util.IdentityHashtable
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 8 more
[sugantha@localhost ~]$

For info I am giving the values of the environment variables required in this case

[sugantha@localhost ~]$ echo $J2EE_HOME
/usr/local/j2sdkee1.3.1
[sugantha@localhost ~]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_05
[sugantha@localhost ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin:/usr/games:/usr/java/jdk1.6.0_05/bin:/usr/local/j2sdkee1.3.1/bin:/home/sugantha/bin:/usr/java/jdk1.6.0_05/bin:/usr/local/j2sdkee1.3.1/bin

You guys have already been very kind...Any suggestions or pointers are appreciated...
 
Old 05-25-2008, 02:04 PM   #10
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Looks like you're missing a required class (IdentityHastable I think -- it's mercifully been a long time since I had to deal with J2EE). Did you check that you installed all the required dependencies and they exist in your $CLASSPATH?

Also, the first little exception is that it tries to write a seed file to a nonexistent path in the filesystem ... perhaps there is some extra directory you need to create?
 
Old 05-25-2008, 03:11 PM   #11
sugantha
Member
 
Registered: Feb 2008
Distribution: Ubuntu 11.04 Natty Narwhal , Fedora Linux
Posts: 43

Original Poster
Rep: Reputation: 15
My CLASSPATH variable is as follows

[sugantha@localhost ~]$ echo $CLASSPATH
/usr/java/jdk1.6.0_05/bin:/usr/local/j2sdkee1.3.1/bin

I have a doubt...In some of the forums I googled I read that I need to include the lib/j2ee.jar that's under the installation directory in my CLASSPATH...But when I did and when I open any new terminal I got some message saying "Failed to load META-INF file for jar"

I went ahead and did %deploytool
and followed the steps prescribed in the book and during the stage of verification I got the following error message

Exception:Exception:javax.xml.transform.TransformerException:java.io.FileNotFoundException
file:/tmp/Results2345771.txt(No such file or directory)

It was mentioned that the tmp directory would be automatically created by the server which it did not in my case.I am obviously missing some classes needed for successful start of the server.Thanks for your suggestions so far...
 
Old 05-26-2008, 05:13 AM   #12
Jim44
Member
 
Registered: Feb 2006
Location: Atlanta, Georgia, USA
Distribution: Mint, Ubuntu, Centos
Posts: 57

Rep: Reputation: 15
I dislike the java use of the "PATH" in their CLASSPATH env variable. In most if not all *PATH env variables it means a directory with files in it, however in the case of java it means the path to a file. So if you set CLASSPATH to the path to the jar e. g. .../lib/j2ee.jar and it still doesn't work, that's an application related problem of which I can't suggest a cure.

Jim.
 
  


Reply


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
exporting environment variables from a file? concoran Linux - Newbie 4 04-19-2008 05:49 PM
how to change environment variables in fedora 7 me_linuxkid Linux - Software 1 09-11-2007 12:32 PM
exporting variables gecoool Programming 2 10-25-2005 01:17 AM
How to set J2SE SDK environment variables on Fedora 2 jjunge Programming 2 07-28-2004 02:27 PM
environment variables and gdm problem cpv204 Slackware 1 05-27-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:14 PM.

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