CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

Getting OpenFOAM to coexist with an existing JAVA VM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2007, 05:06
Default Hi all, Firstly, may I say
  #1
New Member
 
Nik Trevallyn-Jones
Join Date: Mar 2009
Location: Sydney, NSW, Australia
Posts: 2
Rep Power: 0
nik777 is on a distinguished road
Hi all,

Firstly, may I say I am very impressed with what I've seen of OpenFOAM.

I have a query regarding the installation - I hope it doesn't appear that I'm complaining.

OpenFOAM runs fine for me (as far as I have tested), but the installation of OpenFOAM has broken my existing JAVA installation.

I develop and use a lot of JAVA on my machine, and cannot afford to have JAVA broken by another application.

Is there something I've done wrong, or can do differently to get OpenFOAM to coexist with my java installation?

The problem is that the OpenFOAM .basrc unconditionally sets JAVA_HOME, JAVA_PATH and JAVA_ROOT to the OpenFOAM java installation dir.
It also sets CLASSPATH to '.'.

This breaks my other java applications which I wish to run using the VM (JDK 1.6) I have already installed in /usr/java/jdk, and with a CLASSPATH which includees various extensions including JMF and JOGL.

One 'simple' solution which seems apparent is to have the various OpenFOAM tools source the .bashrc file, rather than relying on it being sourced *before* those tools are run. In this way, the OpenFOAM environment settings would be per-process, rather than for every shell I ever run.

However, there is quite probably a better solution already provided, and if so I would be very thankful if someone could point me in the right direction.

Thanks again for such a powerful took.

Cheers!
Nik.
nik777 is offline   Reply With Quote

Old   February 22, 2007, 05:34
Default There is no specific reason to
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
There is no specific reason to use the OpenFOAM java version. Does it work out of the box with your java version? If not you can rebuild FoamX with your java. (Allwmake in $FOAM_UTILITIES/preProcessing/FoamX)
mattijs is offline   Reply With Quote

Old   February 22, 2007, 05:52
Default Hi Mattijs, Thank you for y
  #3
New Member
 
Nik Trevallyn-Jones
Join Date: Mar 2009
Location: Sydney, NSW, Australia
Posts: 2
Rep Power: 0
nik777 is on a distinguished road
Hi Mattijs,

Thank you for your quick response.

> Does it work out of the box with your java version?
Yes, OpenFOAM works with the 1.6 VM that I already have (once I've fixed the environment variables).

My problem isn't that OpenFOAM doesn't work; my problem is that if I source the OpenFOAM .bashrc from my regular .bashrc, then none of my other JAVA apps run.

Does the 'make' you are suggesting rebuild the .bashrc file with different contents? If so, how do I get it to contain the values I need?
As importantly, how do I get it to leave the CLASSPATH variable alone?

Just to be clear: my problem is that ~/OpenFOAM/OpenFOAM-1.3/.bashrc changes the values of the following JAVA environment variables:

JAVA_HOME, JAVA_PATH, JAVA_ROOT, CLASSPATH.

The values that are set stop many other JAVA applications on my machine from running.

Therefore, I am looking for a solution in which OpenFOAM has the values it needs for these variables, and my other JAVA applications have the values that they need, which I have previously configured.

Thanks again for your time and help.

Cheers!
Nik
nik777 is offline   Reply With Quote

Old   February 22, 2007, 06:56
Default A simple work around would be
  #4
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
A simple work around would be to not source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc in your ~/.bashrc file.
Whenever you want to run OpenFOAM, open an xterm and source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc. This way you will restrict the environment variables to only one bash session which belongs to the xterm.
The rest of the system will still use the old values.

Dragos
dmoroian is offline   Reply With Quote

Old   February 22, 2007, 08:13
Default The following snippet might gi
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
The following snippet might give you want you need. NB: the indenting gets lost by the mailer.

# Java
# ~~~~
# avoid altering exising configurations
# compatability issues remain with the user
if [ ! -d "$JAVA_HOME" ]; then

case `uname -s` in
Linux)
export JAVA_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/j2sdk1.4.2_05

[ `uname -m` = ia64 ] && JAVA_HOME=/usr/java/j2sdk1.4.2
;;

SunOS)
export JAVA_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/j2re1.4.2_05
;;

IRIX|IRIX64*)
export JAVA_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/j2re1.4.1
;;

esac

export JAVA_ROOT=$JAVA_HOME
export JAVA_PATH=$JAVA_HOME
export PATH=$JAVA_PATH/bin:$PATH
export CLASSPATH=.
fi
olesen is offline   Reply With Quote

Old   February 22, 2007, 08:21
Default Hello, I do basically the sam
  #6
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hello,
I do basically the same as Dragos. I have a line in my ~/.bashrc:

alias foamSetup='if test "x$WM_PROJECT" != "xOpenFOAM"; then source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc; fi'

and run "foamSetup" in the terminal where I want to run OpenFOAM applications.

Takuya
7islands is offline   Reply With Quote

Reply

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
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Existing Code: Commands Grayed Out Michael Rasche FLUENT 1 July 25, 2012 08:11
How can i use an existing surface mesh? Sebastian CFX 1 February 29, 2008 10:51
return a value for not existing volume in .cse Richard CFX 1 March 19, 2007 12:51
creating spline along existing line cell? guang ai Siemens 3 September 4, 2006 03:33
Initializing using existing data Ray FLUENT 2 September 16, 2002 17:14


All times are GMT -4. The time now is 00:14.