java,eclipse,multithreading,process,inputstreamRelated issues-Collection of common programming errors
Liam W
java android eclipse android-ndk unsatisfiedlinkerror
I’ve been trying to figure out why I’m getting an error stating the method can’t be found, but everything seems to be in order (at least the things that would cause this error).My Android class:package com.liamw.root.androididchanger;import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView;public class DebugUserActivity extends Activity {Button button;TextView logcat;static {System.loadLibrary(“sqlite”);}@Overri
mj_
java ubuntu service daemon jsvc
I’m trying to create a service that will run in Ubuntu Linux written in Java. My executable Jar file is a big fat Jar file that has all the dependencies packaged inside with it. I get the following error when I try to run it using JSVC. Java VM created successfully Class org/apache/commons/daemon/support/DaemonLoader found Cannot register native methods java_init failed Service exit with a return value of 1What’s killing me is the “cannot register native methods” line. What does this mean and ho
user2907333
java android cordova
I’m making an android app which uses bluetooth using phonegap and I’m having issues handling code because it get’s called every 100ms. I want to try if the issue occurs because my phonegap javascript code is to long causing delays. To try this I want to dispaly the received message using a native textbox. Is this possible? and How would I do this?ThanksMartijn PS: I’ve tried using Toast but since I want to change the displayed value every 100ms this doesn’t work.Codeupon receiving a message this
Preetygeek
java c++ winforms jni
So, i have visual studio consloe project that compile to .dll file. I’ve created simple windows form System::Windows::Forms::FormI’ve created a .java file:import java.io.Serializable;public class MyBean implements Serializable{/*** */static{System.loadLibrary(“MyBean”); }private static final long serialVersionUID = 1L;private static native String getDateCpp();public String getDate(){return getDateCpp();}}compiled it and generate a .h file by javah:/* DO NOT EDIT THIS FILE – it is machine genera
Felix
java javassist
With Javassist, is there any way to inject code into a native method? In this case, I’m trying to make the OpenGL calls in my game print out their names and values when called, but all my attempts have hit errors when I assume the openGL dll code is added.The method would look something like:public static native void glEnable(int paramInt);Since the methods initially have no body, the only way I’ve found to actually add the code is with something like:CtBehavior method = cl.getDeclaredBehaviors(
Can Eldem
java eclipse leap-motion
I have a project that uses leap motion sdk. I wrote this project in Eclipse. When I run my program I don’t have any problem because I set my native libraries as it is suggested from configuration. However, when I export my application I can not run my program because Eclipse does not include my native libraries and I am having this error. Native code library failed to load. java.lang.UnsatisfiedLinkError: no LeapJava in java.library.pathMy purpose is create a .jar file which user can run with o
Arturs
java android upnp
From Android 4.1 (under Wi-Fi Direct service discovery) it is suppose to support native UPnP service discovery.I presume it was developed for Wi-Fi Direct, but the methods available seem to be generic. Even the JavaDoc for methods mention that it searches for all UPnP services on the network and not only WiFi Direct slaves/masters.However, I am failing to implement it so that it works… I manage to set up all requirements and I get positive onSuccess callbacks, but I receive no onUpnpServiceAva
TheEnemyOfQuality
java dll linker jni
I’ve got a bit of an odd problem. I have a project in C++ that’s basically a wrapper for a third party DLL like this:MyLibrary –loads DLL_A —-loads DLL_BI load DLL_A with LoadLibrary(), wrap several of its functions and generate my own DLL. I’ve tested this in a C++ project and a C# project. Both do everything they’re supposed to do: load DLL_A, make a couple of function calls, and indirectly load DLL_B. The problem is when I build a DLL for java and make the calls through JNI. Everything run
user614454
java android https
I am trying to make a HTTPS call using Java to a browser that uses the native login prompt.http://blog.stevensanderson.com/2008/08/25/using-the-browsers-native-login-prompt/Currently I’m using the below for HTTP and it works fine for other websites since I know the parameters to put in…however it fails for the above type of login (I am not sure how to capture the parameters…it’s a login pop up..or if this is even the correct approach)….any ideas??..thanksHttpUtility.sendPostRequest(request
Karel Petranek
java java-web-start java-native-interface
I am using Java Web Start to launch a Java application that depends on some third party native libraries. These native libraries then subsequently load another native library (commonLib) as their dependency using LoadLibrary/dlopen.When not using Web Start, everything works as expected when the native libraries are located in the same directory.Web Start, however, requires the native libraries to be packed in a jar file and referenced in the jnlp file, which I did:<!– Windows OS –><re
Liam W
java android eclipse android-ndk unsatisfiedlinkerror
I’ve been trying to figure out why I’m getting an error stating the method can’t be found, but everything seems to be in order (at least the things that would cause this error).My Android class:package com.liamw.root.androididchanger;import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView;public class DebugUserActivity extends Activity {Button button;TextView logcat;static {System.loadLibrary(“sqlite”);}@Overri
Can Eldem
java eclipse leap-motion
I have a project that uses leap motion sdk. I wrote this project in Eclipse. When I run my program I don’t have any problem because I set my native libraries as it is suggested from configuration. However, when I export my application I can not run my program because Eclipse does not include my native libraries and I am having this error. Native code library failed to load. java.lang.UnsatisfiedLinkError: no LeapJava in java.library.pathMy purpose is create a .jar file which user can run with o
0x7fffffff
android c++ eclipse
I am developing an android app using C++ code. Trying using JNI but failed. here is my code: from test.c in jni folder:jstring Segment_com_example_segment_BrowsePicture_test( JNIEnv* env, jobject thiz ) {return (*env)->NewStringUTF(env, “test”); }I already build by ndk and generate libtest.so. but in my BrowsePicture.java (under Segment.com.example.segment) I added public native String test();But I couldn’t call it. the message is :E/AndroidRuntime(16748): java.lang.UnsatisfiedLinkError: N
Keidax
12.04 java eclipse
I upgraded to the 12.04 beta yesterday. Now, when I try to start Eclipse, I get the splash screen and then this error message:An error has occurred. See the log file /home/gabriel/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1335382319394.log .The log file says something like this: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gtk-3740 in java.library.pathno swt-gtk in java.library.pathCan’t load library: /home/gabriel/.swt/lib/linux/x86_64/libswt-gtk
Indian
eclipse
The Eclipse environment is crashing again and again. I started the IDE from the command line and get the following message: # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fd0be867685, pid=4761, tid=140536987805440 # # JRE version: OpenJDK Runtime Environment (7.0_51) (build 1.7.0_51-b00) # Java VM: OpenJDK 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libwebkitgtk-1.0.so.0+0x407685] webkitWebVie
Ian Kemp
android eclipse ant eclipse-3.6 android-3.1
How do I do this from Eclipse? I can’t find any way. I tried creating a build.xml with the following and adding it as the final builder:<?xml version=”1.0″ encoding=”UTF-8″?> <project name=”MobileRecovery” default=”mergelibs”> <loadproperties srcFile=”local.properties” /> <property file=”ant.properties” /> <loadproperties srcFile=”project.properties” /> <fail unless=”sdk.dir” message=”sdk.dir is missing. Make sure to generate local.properties using ‘android updat
Armon-LUStudent
android eclipse opencv android-ndk
I have spent a long while trying to get this thing to work, and I think my error is very trivial but I have been unable to fix it. Plus, I know there have been questions about this before but none have helped me solve my issue.I am using the android-opencv library in eclipse junoWhen I build the sample, I will use sample 4 as an example, I get this message in my console:15:29:35 **** Build of configuration Default for project org.opencv.samples.tutorial4.Sample4Mixed **** “C:\\dev\\android-ndk-r
SSH
linux ubuntu eclipse
I was trying to open eclipse in my ubuntu VM with the below commmand.. And as soon as I do that, I always get the below exception – ubuntu@username-dyn-vm1-48493:~$ eclipse Eclipse: An error has occurred. See the log file /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log.so when I went to that particular log file, this is what I can see in the log – ubuntu@username-dyn-vm1-48493:~$ more /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/
DragonLord
android eclipse resources refresh
I upgraded to Ubuntu 11.10, Eclipse 3.7.0, ADT 14.0.0.When I replaced a picture resource in the /res/drawable-nodpi directory on the desktop, or a sound resource in the /res/raw directory, both the recompiled program and the Project Explorer use some previously cached version.I tried the following, none of which worked:right-click on filename in project explorer: Refresh right-click on /drawable-nodpi dir in p.e.: Refresh right-click on /res dir in p.e.: Refresh right-click on Pr
Rene Dohan
android eclipse
I found this bug http://code.google.com/p/android/issues/detail?id=20731 that is resolved but it did not fix this exactly, but I see in comments that this is mentioned there as problem. Is there some way in eclipse to setup dependencies in project somehow , that I will be able to normally jump to source when I am in eclipse editor ? I tried numerous ways to solve this.My setup is:Android project that has Android Library setup in Android>LibraryAndroid Library project that is within workspace and
Jamal
performance ruby multithreading
I recently answered a question on Stack Overflow where someone asked for advice about making a Hash thread-safe. They indicated that performance was important and that there would be a heavy read bias. I suggested a read-write lock, but couldn’t find a Ruby implementation available anywhere. The only thing I found was a blog entry from 2007 where someone said they had built one, but the link was broken.I thought that a freely available read-write lock implementation for Ruby would be a good thin
Ashes
java multithreading networking
BasicI have an app that is sending packets using DatagramChannel.send in multiple threads each to its own IP address/port and each of them keeping constant bit-rate/bandwidth. Every now and then I get this error:java.net.SocketException: Invalid argument: no further informationat sun.nio.ch.DatagramChannelImpl.send0(Native Method)at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(Unknown Source)at sun.nio.ch.DatagramChannelImpl.send(Unknown Source)at sun.nio.ch.DatagramChannelImpl.send(Unkno
Belgin
multithreading
I’m making a software renderer which does per-polygon rasterization using a floating point digital differential analyzer algorithm. My idea was to create two threads for rasterization and have them work like so: one thread draws each even scanline in a polygon and the other thread draws each odd scanline, and they both start working at the same time, but the main application waits for both of them to finish and then pauses them before continuing with other computations.As this is the first time
hofmeister
java multithreading
This question already has an answer here:Why must wait() always be in synchronized block5 answersI have two Java classespublic class Firstclass {public static void main(String args[]) throws InterruptedException{System.out.println(“Main start….”);Secondclass s=new Secondclass();Thread t1 = new Thread(s);t1.setName(“First Thread”);Thread t2=new Thread(s);t2.setName(“Second Thread”);t1.start();t2.start();System.out.println(“Main close…”); } }andpublic class Secondclass implements Run
Picrofo Software
c# multithreading printing web-browser
I’m trying to create GUI program that generates HTML invoices, and sends them for printing. I have this working. However, now I want to introduce threading.I have a form with a BackgroundWorker. The Background worker runs this code:#region BackGroundWorker private void bg_htmlGeneration_DoWork(object sender, DoWorkEventArgs e) {//SOME MORE CODE..foreach (XElement ele in Lib.GetInvoiceElement(inv, ico.Supplier)){PrintDocument(Lib.CreateHTMLFile());} } #endregion public void PrintDocument(stri
Gennady Vanin Novosibirsk
c# multithreading loops closures task-parallel-library
I’m trying to spawn different threads for some processing. I use the for loop index for some logic inside each thread. How can I get the different threads to print 1,2,3,4, 5 in the code below? Each time I run this, I get different numbers as output – 3,3,3,4,6,6 & 2,2,3,5,5,6 etc. I tried using the lock object, but it stil wasn’t doing it correctly. Can anyone help me achive this. I just want to make sure each thread/task gets the right index. Note that each task has been forced to run on a
Layble
java multithreading file http
I have a file with millions of lines in it that I need to process. Each line of the file will result in an HTTP call. I’m trying to figure out the best way to attack the problem.I obviously could just read the file and make the calls sequentially, but it would be incredibly slow. I’d like to parallelize the calls, but I’m not sure if I should read the entire file into memory (something I’m not a huge fan of) or try to parallelize the reading of the file as well (which I’m not sure would make
Wug
java multithreading constructor thread-safety
I’ve been searching for justification as for why you should not call a thread’s start method inside a constructor for a class. Consider the following code:class SomeClass {public ImportantData data = null;public Thread t = null;public SomeClass(ImportantData d){t = new MyOperationThread();// t.start(); // Footnote 1data = d;t.start(); // Footnote 2} }ImportantData is some generic box of stuff (presumably important) and MyOperationThread is a subclass of thread that knows how to handle SomeCl
siva
multithreading debugging operating-system deadlock
Process has some 10 threads and all 10 threads entered DEADLOCK state( assume all are waiting for Mutex variable ).How can you free process(threads) from DEADLOCK state ? . Is there any way to kill lower priority thread ?( in Multi process case we can kill lower priority process when all processes in deadlock state).Can we attach that deadlocked process to the debugger and assign proper value to the Mutex variable ( assume all the threads are waiting on a mutex variable MUT but it is value is 0
Michael Myers
python multithreading signals
In my program I have a bunch of threads running and I’m trying to interrupt the main thread to get it to do something asynchronously. So I set up a handler and send the main process a SIGUSR1 – see the code below:def SigUSR1Handler(signum, frame):self._logger.debug(‘Received SIGUSR1’)returnsignal.signal(signal.SIGUSR1, SigUSR1Handler)[signal.signal(signal.SIGUSR1, signal.SIG_IGN)]In the above case, all the threads and the main process stops – from a ‘c’ point of view this was unexpected – I want
Gilles
command-line networking process ip netstat
I am trying to run weblogic server on my linux machine and I am getting the following error :ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)I think that the error means that the debugger p
carols10cents
project-management process agile scrum
My company has recently started using Scrum; we’ve done 2 sprints. We’re still learning, but we’ve definitely exposed and fixed some problems in our development process already. So in general I think it has been good for us.In reading many of the internet musings about Scrum from evangelists, cynics and everyone in between, three common and somewhat contradictory themes have stood out to me:Scrum implementation fails because the processes of Scrum are not followed closely enough. Scrum implement
Brannon
c# .net process ffmpeg pipes
When I run FFMpeg from the command line like thisffmpeg.exe -hwaccel auto -re -i “C:\Users\Public\Videos\Sample Videos\Wildlife.wmv” -an -sn -c:v bmp -pix_fmt bgr24 -f rawvideo – > junk.binit works fine. However, when I spawn the exact same thing (minus > junk.bin) I get this nasty “bad header” error after a few seconds of playback. What is causing this? I have trouble believing my process blocks the pipe longer than the filesystem does, but it should be able to block the pipe indefinitely
Marcus Thornton
linux bash shell process fork
I want to run test1.sh, test2.sh and test3.sh in background and record the execution time respectively. So I used the following commands.time `./test1.sh & ; wait` > record_1 time `./test2.sh & ; wait` > record_2 time `./test3.sh & ; wait` > record_3While the content in test1.sh could be going to call other script:./other_test1.sh &So test2.sh and test3.sh could call ./other_test2.sh & and ./other_test3.sh &The reason I want to use wait is because test1.sh and ot
mikiemorales
c process fork parent-child wait
I’m starting to learn some C and while studying the fork, wait functions I got to a unexpected output. At least for me. Is there any way to create only 2 child processes from the parent? Here my code:#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/wait.h>int main () {/* Create the pipe */int fd [2];pipe(fd);pid_t pid;pid_t pidb;pid = fork ();pidb = fork ();if (pid < 0){printf (“Fork Failed\n”);return -1;}else if (pid == 0){//printf(“I’m the
Vivasaayi
asp.net vb.net process report rdlc
I am getting the following error when doing load test of a page which renders a An error occurred during local report processing. —> Microsoft.Reporting.DefinitionInvalidException: The definition of the report ‘Main Report’ is invalid. —> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred while compiling expressions. Native compiler return value: ‘128’.This page works fine initially and then fails.Any thoughts appreciated.I tried run
darren
python shell process pipe
I’m wrestling with the concepts behind subprocesses and pipes, and working with them in a Python context. If anybody could shed some light on these questions it would really help me out.Say I have a pipeline set up as followscreateText.py | processText.py | catprocessText.py is receiving data through stdin, but how is this implemented? How does it know that no more data will be coming and that it should exit? My guess is that it could look for an EOF and terminate based on that, but what if c
Maksee
performance winapi process
Everyone probably knows the code to run a program and wait for it to end:CreateProcess(…WaitForSingleObject(Process.hProcess, INFINITEIt was used several times by myself. But recently I found that this call when it launches a program with a multimedia playback has worse performance than the same process being executed from a general file manager (Windows XP). That’s ok with CPU consumption of my (parent) process, but while playing the fragment there are unexpected little stops. I made a little
Andreas Pasch
java ubuntu process kill
I have a small java server listening on port 10299 for performing some image processing on demand. I start the program as follows:java -Xms15m -Xmx25m -jar /tools/image-server.jar > /tools/image-server.log &After an indeterminate period of time the process gets killed whithout any error message (or at least i haven’t discovered any…). The OS is Ubuntu 10.04.3 LTS.The code itself seems to be working fine, since it is running without error on my other machine.What could cause the unexpect
Daniel Beardsley
php process pipes exit-code
I’m using proc_open in php to launch a subprocess and send data back and forth.At some point I’d like to wait for the process to end and retrieve the exit code.The problem is that if the process has already finished, my call to proc_close returns -1. There is apparently much confusion over what proc_close does actually return and I haven’t found a way to reliably determine the exit code of a process opened with proc_open.I’ve tried using proc_get_status, but it seems to also return -1 when the
Visruth CV
java android web-services inputstream saxparser
HttpURLConnection.getInputStream() gives UnknownLengthHttpInputStream and due to this Document parsing throws SAX parser exception. Following is the code try{URL url = new URL(uri);HttpURLConnection connection =(HttpURLConnection) url.openConnection();connection.setRequestMethod(“GET”);connection.setRequestProperty(“Accept”, “application/xml”);InputStream xml = connection.getInputStream();System.out.println(connection.getResponseCode());DocumentBuilderFactory dbf = DocumentBuilderFactory.newInst
esaj
java string inputstream zipfile
Here the main functionality of my web application is to upload .zip file and store it at the server side but before doing that I need to do some following task: 1.) .zip file contains the xml file, I have to first validate the xml file using schema. 2.) if the xml file is valid than I need to convert the content of the xml file into string without unzipping the file i.e. from the inputstream.I am successfull in validating the xml file but I am getting the following exception while converting the
Prateek Jassal
android inputstream
Trying to download a large file on Android 2.3.5 on a HTC explorer. I keep getting the exception java.io.IOException at this point :while ((oneChar = is.read()) != -1) FYI is – InputStream. It throws java.io.IOException : unexpected end of stream.It does not happen all the time but happens frequently enough. I tried searching for this and found out that apparently there is a bug in Android 2.3.3 relating to this but my question is then how is everybody else able to download stuff on Android 2.
dave
java android xml inputstream assets
I’m trying to parse an XML file thru a DOM parser. However, I am having difficulty in getting my Main Activity to actually read the file. I’ve read that I should place the file in Assets and then called with getAssets(). I used something like this:InputStream is = this.getAssets().open(“myXML.xml”);This just results in an error: Unexpected error while launching logcat. Try reselecting the device.] device not found.I’ve also tried new File(“myXML.xml”) using variations on the absolute path. Nothi
Brian
java stream inputstream classcastexception recover
I’m writing a server and I’m using an ObjectInputStream to handle proprietary packets. I’ve recently been sometimes getting some unexpected ClassCastExceptions when I want call objectInputStream.readObject() and then trying casting them into the proprietary packets. I’ve been trying to trace the problem and I’ve been wondering whether it’s because the objectInputStream is crashing due to some problem. According to the documentation for the method objectInputStream.readObject()… “All exceptions
ghostdog74
java inputstream java-util-scanner
what’s the correct way to use multiple Scanner objects in my program. For example, I use scanner to read a file, then depending on what is found in the file, i use scanner again to prompt for user input. An extract of my code is shown…. Scanner f = new Scanner (System.in); //get the file name String fileName = f.next(); Scanner input = new Scanner( new File( fileName ) ); while ( input.hasNext() ) {String currentLine = input.nextLine();if ( some pattern found) {Scanner getUserInput = new Scan
user1486691
c# inputstream sharpziplib
This is what I have:byte[] buff = new byte[1];byte[] buffer = { 10, 20, 30, 40 };Stream data = new MemoryStream(); data.Write(buffer, 2, 2);data.Position = 0;InflaterInputStream _inflater; _inflater = new InflaterInputStream(data);int count = _inflater.Read(buff, 0, 1);It throws SharpZipBaseException: Header checksum illegal and unexpected EOF exception, and data.Position is 2 by the end.Can anyone tell me what might be the problem and how to fix it? Thanks in advance.
Mahe
android file inputstream
I built a sample app which gets input from user and save in a text file “sample” in assets folder of my app.Here is my MainActivity.java,package com.example.sampledatabaseapp;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStreamWriter;import android.os.Bundle;import android.app.Activity;import android.content.Context;import android.content.res.AssetManager;import android.text.Edi
Mr. White
java exception io inputstream eofexception
It seems dirty to use an exception to indicate the end of a file has been reached. Every file we read has an end, so it doesn’t seem exceptional or unexpected. Furthermore, I don’t like using an exception for the non-exceptional flow of my program.I’m talking about using java.io.EOFException to signal the end of a data input stream:Imagine a file consisting of the following messages… —————– —————— – 2-byte LENGTH – – N-byte PAYLOAD – , where N = LENGTH; —————–
Giovanni Oliveira
java android sockets timeout inputstream
I have an Android App that talks with a Java Server between socket connection. When server is running, there’s no problem. I send something from Android and server answer. I get response and put it in Toast. Looks great! But if i stop running server, Android stay waiting for answer and all application stop working. Strange is the fact that application in running inside a thread, so i think its not supposed to happen. I’d like to know if is there some way to avoid it to crash application and some
Web site is in building