Cannot find the shared library (java.lang.UnsatisfiedLinkError) - java

I need to run my Eclipse project on a different laptop. The following error occurs when running the code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: The shared library C:\Archivos de programa\ECLiPSe 6.0\lib\i386_nt\ec_java_load.dll could not be found.
How can I configure the correct path to "ec_java_load.dll"? It should be "C:\Program Files..." instead on the current one.

I see this a lot when moving eclipse projects around. I also see eclipse mentioned in your error string, so I think I'm on the right track.
To fix this, you have to go into the project settings - build path, remove the old non-working lib and add the right one for the environment you are in

Related

UIMA installation: exception in thread "main" java.lang.classcastexception

I am trying to configuire eclipse (in Windows) with UIMA using this tutorial . I have followed each step exactly and finaly am able to import uimaj-example in eclipse with no error. but I am unable to import the UIMA packages in my java class. (The import org.apache.uima.analysis_component cannot be resolved). The project structure is as following:
In UIMA-SDK folder, the read-me suggested to test the installation, run the documentAnalyzer.bat (or .sh) file located in the bin subdirectory.
the documentAnalyzer.sh run just for a moment and then disappears showing this:
(Sorry for the blur image, i wasnt able to take clear screenshot as it appeared only for a second)
I have already
imported UIMA in build path of my project
added UIMA_HOME variable in eclipse java/classpath
set the Enviroment variable path of directory
I am new to Java and UIMA. I might be doing something wrong, clearly. Any suggestion would be very helpful.

Why is Visual Studio trying to use the wrong JDK version?

I am trying to build WeatherApp, which comes from this tutorial, but I am seeing this error:
The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_55\bin\javac.exe" is invalid.
and this warning (not sure if they are related):
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>
I can doube-click the warning to make it go away, but the error remains. I am not sure why the project is trying to use that version of the jdk, as I have changed my xamarin optioins to point at Program Files instead:
Why is Visual Studio trying to use that versioin of the JDK?
Sometimes there's a sdk.caches file that will hold an old reference. Please try to delete both your obj/bin folders and see if that resolves the issue. If it doesn't, turn up your Build Output verbosity and attach a Build Output Log to your post:
https://forums.xamarin.com/discussion/27515/how-to-obtain-diagnostic-build-logs (XS)
http://blogs.msdn.com/b/msbuild/archive/2005/09/29/475157.aspx (VS)

SIGAR error: Operation not permitted

I need a Java library that can tell me the current load of a server, so after searching I found that SIGAR is currently the most well known and well accepted amongst the community.
I am using Linux Mint 64-bit as operative system (it is a slight modification of Ubuntu) and since it is my first time using such a library I created a new project from zero using Eclipse and decided to install SIGAR on it by doing:
Download and extract the ZIP file
Create a folder called "libs" in my new Java Project
Copy the Sigar.jar and libsigar-amd64-linux.so files into the "libs" folder
Right Click Project -> Properties -> Java Build Path -> Libraries -> Add External JARs -> Add Sigar.jar
Cross fingers and run project
However, when I run the project I get the following error:
/media/data/Users/pedro/SIGAR/libs/libsigar-amd64-linux.so: /media/data/Users/pedro/SIGAR/libs/libsigar-amd64-linux.so: failed to map segment from shared object: Operation not permitted
org.hyperic.sigar.SigarException: /media/data/Users/pedro/SIGAR/libs/libsigar-amd64-linux.so: /media/data/Users/pedro/SIGAR/libs/libsigar-amd64-linux.so: failed to map segment from shared object: Operation not permitted
at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172)
at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100)
at examples.Shell.<init>(Shell.java:50)
at examples.SigarCommandBase.<init>(SigarCommandBase.java:75)
at examples.CpuInfo.<init>(CpuInfo.java:36)
at examples.CpuInfo.main(CpuInfo.java:97)
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Sigar.getCpuInfoList()[Lorg/hyperic/sigar/CpuInfo;
at org.hyperic.sigar.Sigar.getCpuInfoList(Native Method)
at examples.CpuInfo.output(CpuInfo.java:60)
at examples.SigarCommandBase.processCommand(SigarCommandBase.java:186)
at examples.CpuInfo.main(CpuInfo.java:97)
I checked the Internet and the Operation not permitted error usually occurs when I do not have the write or read permissions, but such is not the case.
Consequently I have some questions:
Have I messed up the installation?
If yes, how should I do it and can someone point me to a beginners tutorial?
If not, how can I fix the error? I already tried running Eclipse as root but it didn't work.
Thank you for your time, Pedro.

How to resolve Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path?

I am stuck one point.
I am getting this error from eclipse
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
I tried few links and tried to solve problem, but I am unable to do so.
I changed Jar file location, no output
I also tried to change eclipse.ini, but it also couldn't resolve it.
What should I do?
If any other information or image is required regarding issue, I will provide. ask me in comments.
Thanks
Duaan
In your run configuration in Eclipse, add
-Djava.library.path=<path to JOGL>
under Arguments -> VM Arguments.
When you run outside of Eclipse, you'll need to make sure the native libraries are accessible too. As Hot Licks mentioned, these are the native libraries (e.g. dll files in Windows), not just the Java class files that come with JOGL.

Eclipse ClassNotFoundException

Everything works fined, but suddenly eclipse stopped execute and junit tests or even main method, when i run them using run as - > Java application, run as -> junit test
It simply throws error
Caused by: java.lang.ClassNotFoundException: package.ClassName
whene ClassName - is class from where i trying to run method main.
It affect only one of my projects ... Different workspaces works fine, other project in same workspace works fine as well.
I'm sure if i recreate current project, error will gone. But the adjustments of this project in eclipse is really hard, so i want to avoid it.
Any clue?
The ClassName is not in the Class Path, if you start from console you should use -cp parameter , if from eclipse, please add ClassName to the sources of current(start) project.
Thanks to adarshr, I was able to look at the Problems window and determine that the build was failing because it could not find a class I had written.
I had used the MS TFS plugin to create a "shelveset" and it was supposed to have removed my pending changes in the process. However, this integration with the TFS snapin and Eclipse is obviously not well implemented, since the Eclipse project still thought the file existed and was complaining that it could not be compiled.
I went and manually deleted those "files" or "non-existing files" from the Eclipse project (that I thought I had removed with the shelveset action) and the problem was solved.
Also....
Another annoying things is that the Tomcat error I was getting by trying to debug within Eclipse was like this:
SEVERE: Error configuring application listener of class
com.CompanyName.ProjectName.servlet.StartupConfigListener
java.lang.ClassNotFoundException:
com.CompanyName.ProjectName.servlet.StartupConfigListener at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
In reality, there was no problem at all with StartupConfigListener.java!! The build failed due to the OTHER problems I mentioned above, and therefore I guess this was the first class it attempted to load and failed.... because the entire project hadn't been able to compile perhaps?
(Here's to hoping my next project is using Visual Studio instead of Eclipse!)
Ok, I finally figured it out. The problem was with installed JRE in eclipse setting. I was playing around with this setting and changed installed JRE to JDK, and for some reason it broke the eclipse project.
You can also try going back to the basics. Check your command line and VM args. I've had this situation where a VM arg I was passing in was a path to a file that had a space in the path, and I had forgotten to include the full path in quotes. So e.g., if my arg looked something like
-DFILE=C:\Documents and Settings\myfile
...I'd get a java.lang.NoClassDefFoundError caused by a java.lang.ClassNotFoundException.

Categories