File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Configuring Eclipse in Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Configuring Eclipse in Linux" Watch "Configuring Eclipse in Linux" New topic
Author

Configuring Eclipse in Linux

Paul Lusk
Ranch Hand

Joined: Aug 29, 2009
Posts: 34
Helllo Linux Users,
I am new to Linux . I have in installed Fedora 12 and am trying to configure java and eclpse. Have java running fine from my usr directory. Having problem starting Eclipse. Get message
Failed to load the JNI shared library "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/bin/../lib/i386/client/libjvm.so".
A couple of points and/orquestions regarding this error message. First , I used file browser to look for this lib file and found that my file structure is slightly different than what eclipse expects. I found the file by looking under lib/i386/client where lib is choice in same sub as bin under jre .
A question I have is regarding The significance of the /../ structure in the error message file path. What does that indicate ?
So I am wondering do I need To find a way to tell Eclipse To look where I know the file is or do I need to find a way to create the file structure Eclipse is looking for?
Does Eclipse think the file is where the error message indicates because of an environmental setting or what?
So I am open to suggestion as to best way to proceed . Thanks in advance. Paul L
Paul Lusk
Ranch Hand

Joined: Aug 29, 2009
Posts: 34
Yikes, I think I just saw a tumbleweed rolling through this forum.
PL
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

I think that Eclipse is expecting the Sun JDK with the typical directory structure. Unfortunately, Linux distros often place things in "intersting" locations which is why I never rely on any distro to install anything Java related. Try downloading and installing the Oracle JDK (download the *.rmp.bin file) and see how that goes.

Another possibility is to add lines like this to the eclipse.ini file:

-vm
<full-path-to-libjvm.so>


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Because Sun's JDK carries non-opensource license restrictions, it is not distributed with the major Linux distros. However, unlike Windows, which is still sulking because they couldn't embrace, extend and extinguish Java with J++, most modern distros do provide some sort of Java as part of the standard install. It's just not a very good implementation of Java.

As a general rule, anything involving J2EE or the Swing GUI won't work on gcj or openjdk. They're not complete implementations (although openjdk is approaching it).

So, as Peter said, it's best to download and install the JDK RPM from, er "Oracle America". Set JAVA_HOME to point to the installed JDK (/usr/java/xxxxxx), add $JAVA_HOME/bin to your PATH and you're good to go.

The problem with implementations like openjdk isn't so much with directory structure as it is with stuff that's just not (completely) implemented. Yes, the directories show up in locations specific to the OS, but the essential channels are preserved. But you do want to set a JAVA_HOME for Eclipse to reference.


Customer surveys are for companies who didn't pay proper attention to begin with.
Paul Lusk
Ranch Hand

Joined: Aug 29, 2009
Posts: 34
Thanks to both Peter And Tim for your responses to my question. I did actually already install Sun/Oracle java but my java.conf file does still point to the openjdk file locations . I will change those settings and st up bash_profile to point to downloaded java file locations. Thanks again . PL
Paul Lusk
Ranch Hand

Joined: Aug 29, 2009
Posts: 34
To Anyone who has seen the following SELinux Security alert

Summary:

SELinux is preventing /opt/eclipse/eclipse from making the program stack
executable.

Detailed Description:

The eclipse application attempted to make its stack executable. This is a
potential security problem. This should never ever be necessary. Stack memory is
not executable on most OSes these days and this will not change. Executable
stack memory is one of the biggest security problems. An execstack error might
in fact be most likely raised by malicious code. Applications are sometimes
coded incorrectly and request this permission. The SELinux Memory Protection
Tests (http://people.redhat.com/drepper/selinux-mem.html) web page explains how
to remove this requirement. If eclipse does not work and you need it to work,
you can configure SELinux temporarily to allow this access until the application
is fixed. Please file a bug report.

Allowing Access:

Sometimes a library is accidentally marked with the execstack flag, if you find
a library with this flag you can clear it with the execstack -c LIBRARY_PATH.
Then retry your application. If the app continues to not work, you can turn the
flag back on with execstack -s LIBRARY_PATH. Otherwise, if you trust eclipse to
run correctly, you can change the context of the executable to execmem_exec_t.
"chcon -t execmem_exec_t '/opt/eclipse/eclipse'" You must also change the
default file context files on the system in order to preserve them even on a
full relabel. "semanage fcontext -a -t execmem_exec_t '/opt/eclipse/eclipse'"

Fix Command:

chcon -t execmem_exec_t '/opt/eclipse/eclipse'

Ok then, My Questions are 1) How common is this situation and 2} Is the workaround mentioned a safe permanent fix ?
Thanks in advance. PL
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Was this part of your original problem or is it a new problem?

I normally run with selinux enabled except when certain software products from a 3-letter megacorporation are too rude and crude to permit otherwise.

Eclipse itself I have no problems with. You may have a plug-in that offends, though.

One solution may be to run selinux in permissive mode, but a longer-term solution would be to either evict the offending component or construct an selinux access rule that allows what you need without opening up security in general.
Paul Lusk
Ranch Hand

Joined: Aug 29, 2009
Posts: 34
Hi Tim, Thanks again for your response.
By the way, I just posted a reply to your response which now seems lost in cyberspace , so if it shows up again and sounds a lot like this post , you know why . Guess I will save this message to clipboard before sending again just in case. Problem may have to do with using quick reply rather than post reply button
Anyway to answer your question , No, the security alert did not appear while I was getting previous error about not being able to load library file in openjdk. I am now running jdk1.6.0_21
and Eclipse Helios. I believe that previous error did not let me get to the point where this security alert would come into play.
I did a google search on exexStack error and found several forum discussions .The best on on stack overflow discussing issue with Eclipse at
http://stackoverflow.com/questions/2332353/eclipse-startup-error-in-fedora-12
that actually refers to blog at
http://danwalsh.livejournal.com/13716.html
that discusses issue with Symphony ( and mentions a certain 3-letter name megacorp )
So I tried several proposed solutions including trying to clear the execstack flag , but the only thing that worked was to run
chcon -t execmem_exec_t '/opt/eclipse/eclipse'
I am running Helios as downloaded from Eclipse site ( no added plugins ) so not sure what component would be problematic. You mentioned constucting access rule . Would that be any different/better than the code line i ran which as far as I can tell basically OK's Ecllipse to make stack executable. Thanks again PL
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring Eclipse in Linux