SIGAR error: Operation not permitted - java

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.

Related

Business Objects 'bcm.jar' error when exporting Java app

I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:
java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM
I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth);
Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)
EDIT: I would be happy to provide clarification or further detail upon request!
Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.
Have you included the cryptojFIPS.jar? Leaving it out can cause the error.

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)

ClassNotFoundException with static context class [duplicate]

I write a android app in Eclipse and use run command on my cellphone.
It's run success on my cellphone.
But I use [Android Tools -> Export Signed Application Package...] to export my app.
Then use [adb install] to install apk on my cellphone and run.
And I got the error message:
07-22 11:20:43.537: E/AndroidRuntime(20216): Caused by: java.lang.ClassNotFoundException: com.mytest.MyActivity in loader dalvik.system.PathClassLoader[/data/app/com.mytest-1.apk]
In [Java Build Path -> Order and Export], I have been selected all.
In AndroidManifest.xml, the application attribute doesn't have android:name.
I don't know how to solve this problem.
I'm success use Eclipse run on my cellphone, why run error when I export the app?
please help me, thanks!!
I had same issue, after 2 hours of research I managed to fix this problem by deleting "bin" and "gen" folders and rebuilding project.
There seems to multiple reasons for this happening from what I have researched. Do you have a lib folder? if so change it to "libs".
Do you have proguard enabled? If so that may cause the problem.
Also try unchecking the "Android #.#.#" and "Android Dependencies" in your Build Path, Order and Export.
Check out this thread which has a bunch of other possible solutions, a lot of them deal with setting the proper ActivityName in the manifest file.
java.lang.ClassNotFoundException on working app
If those solutions still don't solve the problem try these threads.
Android: Unable to instantiate activity / ClassNotFoundException
ClassNotFoundException Android
What I had to do is just re-do the building/exporting process with no modification to the code whatsoever. It worked for me, which I did was to export it two times.
On my first export, the build APK has lower file size and the second export (with no any modification to the code/configuration) produced a slightly larger file size (about 200KB diff).
This bug in building is really costly, kills you in front of your manager, and should be really fixed by Android/Eclipse team. Kind of sucks

Using JavaTreeProfiler

I want to use javaTreeeProfiler to profile my simple java program. I want to use it with 32-bit linux. I downloaded it from http://sourceforge.net/projects/jcoverage/
The readme file says that "To run the profiler copy the libjprofiler.so to a location that can be found by the dynamic loader." Can anybody tell me what does it mean ? where should I copy that libjrofiler.so file ? I tried to build it. It showed build successfully message but i did not see any call tree. I tried to run it with my simple application but that also did not work. It says :
Error occurred during initialization of VM
[java] Could not find agent library jprofiler on the library path, with error: libjprofiler.so: cannot open shared object file: No such file or directory
[java] Java Result: 1
Could anybody pl guide me how do I run simple java program with this profiler ?
Thanks.
JTreeProfiler is quite old project. Now there is jvisualvm included in JDK and it has excellent profiler built in.

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

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

Categories