LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with exporting environment variables in Fedora (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-exporting-environment-variables-in-fedora-644608/)

sugantha 05-25-2008 02:06 AM

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...

colucix 05-25-2008 02:18 AM

Quote:

Originally Posted by sugantha (Post 3163923)
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.

sugantha 05-25-2008 04:59 AM

Thanks for your reply..where can I find this file /.bashrc to edit...

sugantha 05-25-2008 05:02 AM

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.

Nylex 05-25-2008 05:33 AM

Anywhere before the end of the file will do.

Quote:

Originally Posted by sugantha (Post 3163978)
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.

sugantha 05-25-2008 06:02 AM

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...

Nylex 05-25-2008 06:14 AM

What specific problems are you having?

Jim44 05-25-2008 06:16 AM

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

sugantha 05-25-2008 12:25 PM

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...

btmiller 05-25-2008 02:04 PM

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?

sugantha 05-25-2008 03:11 PM

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...

Jim44 05-26-2008 05:13 AM

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.


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