Shell script is not careful in finding DR_HOME
Rather than put more and more directories in my path, I use a centralized personal bin directory and use symbolic links to link to the actual scripts. This means the dr script is located at ~/bin/dr. However the dr script neither allows me to force a setting of the DR_HOME environment variable nor does it protect against symbolic links using the classic idioms.
I am using the RC1 download and have a fully installed system that works.
525 balin:~/lib/Java/datarush/bin
|> dr -v
Product version: 4.0.0.RC1
Java version: 1.6.0_0 in /usr/lib/jvm/java-6-openjdk/jre
526 balin:~/lib/Java/datarush/bin
|>
However:
507 balin:~
|> which dr
/home/users/russel/bin/dr
508 balin:~
|> dr -v
Exception in thread "main" java.lang.NoClassDefFoundError: com/pervasive/datarush/config/CliHelper
Caused by: java.lang.ClassNotFoundException: com.pervasive.datarush.config.CliHelper
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Could not find the main class: com.pervasive.datarush.config.CliHelper. Program will exit.
509 balin:~
|>





Hey russel,
Sorry for the delay in a response.
I'm sure you've already resolved the issue by simply editing the
drscript and modifyingDR_HOMEto point directly to the location in which you installed it.However, we're working on a nice solution for the next release that runs something like this:
The main trouble I see with this approach is that Cygwin (or my install, at least) didn't come with
whichby default, so I had to download it. For those fortunate enough to not have to deal with Cygwin, this shouldn't be a problem!The maven CLI script, mvn, contains quite a bit of logic to deal with symbolic links. We should consider using this code as a model - including the way it sets M2_HOME only if it's not set already. That would address the other part of Russel's complaint, allowing the forcing of DR_HOME if the script can't find it.
So many platforms, so little time...
Looking at that script really reinforces how much of a script newbie I am. It will definitely help us polish up
dr.