Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » how do I set an env.var OSX from within Eclipse
how do I set an env.var OSX from within Eclipse [message #86161] Mon, 18 August 2003 12:42 Go to next message
Eclipse UserFriend
Originally posted by: peter.publiactief.be

Hi,

I'm using Eclipse 3.0M2 on Mac OSX 10.2 and Windows 2000 Prof.

I'm automating Canto Cumulus (an Asset Management tool) with java
and to be able to do this an environment variable has to be defined
in MAC OS X.

From the terminal I do
sh (to start a shell)
export DYLD_LIBRARY_PATH=/usr/local/CumulusJC5/lib
javac myprogram.java
java myprogram

and this works
But from within eclipse I get an error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no CumulusJC in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at
java.lang.Runtime.loadLibrary0(Runtime.java:788)
at
java.lang.System.loadLibrary(System.java:832)
at
com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:447)
at
com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:390)
at
CCSI.test1(CCSI.java:660)
at CCSI.main(CCSI.java:19)


What shell does Eclipse use and how do I set this pathvariable?
Or can I somehow have java itself look into that directory
(java.library.path)?

I do not have the soourcecourde of the Cumulus-javaclasses, just a JAR.
So I can change it their...

Thanks for any help...
Re: how do I set an env.var OSX from within Eclipse [message #91208 is a reply to message #86161] Mon, 01 September 2003 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Andre_Weinand.oti.com

On 18.8.2003 14:42 Uhr, in article bhqhje$our$1@eclipse.org, "Peter Van de
Poele" <peter@publiactief.be> wrote:

> Hi,
>
> I'm using Eclipse 3.0M2 on Mac OSX 10.2 and Windows 2000 Prof.
>
> I'm automating Canto Cumulus (an Asset Management tool) with java
> and to be able to do this an environment variable has to be defined
> in MAC OS X.
>
> From the terminal I do
> sh (to start a shell)
> export DYLD_LIBRARY_PATH=/usr/local/CumulusJC5/lib
> javac myprogram.java
> java myprogram
>
> and this works
> But from within eclipse I get an error
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no CumulusJC in
> java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
> at
> java.lang.Runtime.loadLibrary0(Runtime.java:788)
> at
> java.lang.System.loadLibrary(System.java:832)
> at
> com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:447)
> at
> com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:390)
> at
> CCSI.test1(CCSI.java:660)
> at CCSI.main(CCSI.java:19)
>
>
> What shell does Eclipse use and how do I set this pathvariable?
> Or can I somehow have java itself look into that directory
> (java.library.path)?
>
> I do not have the soourcecourde of the Cumulus-javaclasses, just a JAR.
> So I can change it their...
>
> Thanks for any help...
>
>

Instead of setting an environment variable you can specify the library
directory via a command line argument for the compiler and Java VM.

If your Cumulus library contains native code (and is accessed from Java via
JNI) you will have to add it to the java.library.path of the Java VM as
follows:
java -Djava.library.path=/usr/local/CumulusJC5/lib

If the library is just a Java archive (*.jar) you'll have to pass is to the
compiler:
javac -classpath /usr/local/CumulusJC5/lib myprogram.java
and the VM:
java -classpath /usr/local/CumulusJC5/lib myprogram

When launching Java programs from within Eclipse you typically don't have to
specify the classpath manually.
And the Java library path can be specified in the "Run..." dialog. Select
your configuration and select the "Arguments" tab. In the VM arguments field
enter:
-Djava.library.path=/usr/local/CumulusJC5/lib

--andre
Re: how do I set an env.var OSX from within Eclipse [message #148140 is a reply to message #86161] Thu, 11 March 2004 11:09 Go to previous message
Eclipse UserFriend
Originally posted by: dimitri.bosiers.pandora.be

Peter Van de Poele wrote:
> Hi,
>
> I'm using Eclipse 3.0M2 on Mac OSX 10.2 and Windows 2000 Prof.
>
> I'm automating Canto Cumulus (an Asset Management tool) with java
> and to be able to do this an environment variable has to be defined
> in MAC OS X.
>
> From the terminal I do
> sh (to start a shell)
> export DYLD_LIBRARY_PATH=/usr/local/CumulusJC5/lib
> javac myprogram.java
> java myprogram
>
> and this works
> But from within eclipse I get an error
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no CumulusJC in
> java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
> at
> java.lang.Runtime.loadLibrary0(Runtime.java:788)
> at
> java.lang.System.loadLibrary(System.java:832)
> at
> com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:447)
> at
> com.canto.cumulus.Cumulus.CumulusStart(Cumulus.java:390)
> at
> CCSI.test1(CCSI.java:660)
> at CCSI.main(CCSI.java:19)
>
>
> What shell does Eclipse use and how do I set this pathvariable?
> Or can I somehow have java itself look into that directory
> (java.library.path)?
>
> I do not have the soourcecourde of the Cumulus-javaclasses, just a JAR.
> So I can change it their...
>
> Thanks for any help...
>
>
>
Whel OsX is BSD but is is a special kind
As you moslikely know you can set enviroment-vars in
/etc/profile(systemwide) or in the users bash.rc files.
This is how it is done for a shell scripts etc.

BUT !!

To run a java application like it should something else is needed
(in fact to run any aplication)

OSX knows something like .plist files they contain information about the
enviroment an d arguments to use when running an aplication and they
recide in the app's bundle (wich is in fact a folder).

You can open the file like this:

In the finder click on eclypse and press and hold <CTRL>
select "show package contents"
open the Contents folder
open Info.plist in a good text-editor (BBEdit)
or yust click on it so that it opens in your standard plist-editor.

You will discover a nice xml-file wich looks like this
(i'll added comments to explain the functions but you have to remove them ):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
----- bundle , icon and filedescriptor information (don't edit) ------
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Eclipse</string>
<key>CFBundleIconFile</key>
<string>Eclipse.icns</string>
<key>CFBundleGetInfoString</key>
<string>Eclipse 2.1 for Mac OS X, Copyright IBM Corp. and others 2001,
2003. All rights reserved.</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Eclipse</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.1</string>

<key>Java</key>
<dict>
----- JVM settings ------
<key>JVMVersion</key>
<string>1.3.1</string> ---> JVM to use

<key>VMOptions</key>
<array>
<string>-Xms30M</string> ---> minimum memory
<string>-Xmx150M</string> ---> maximum memory
</array>
<key>ClassPath</key>
<string>$JAVAROOT/startup.jar</string>
<key>MainClass</key>
<string>org.eclipse.core.launcher.Main</string>
<key>Arguments</key>
---- arguments to passed to the main-class ----
<array>
<string>-noupdate</string>
<string>-consoleLog</string>
<string>-showlocation</string>
<string>-os</string>
<string>macosx</string>
<string>-ws</string>
<string>carbon</string>
</array>
</dict>
</dict>
</plist>

Hope this helps you,

Dimitri
Previous Topic:instance method references
Next Topic:Can we block hot code replace from happening to 1 file?
Goto Forum:
  


Current Time: Wed Nov 26 16:53:43 GMT 2014

Powered by FUDForum. Page generated in 0.02101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software