Thread wait time

367 byte By mullapudia at 2007-11-27 9:33:02
Hi all, I need to make my thread sleep after certain amount of time. There are around 30 threads running. If my thread is in waiting state for some time, i am not able to know the time how much time it has to sleep. my problem is to find how much time the current thread is in waiting state to ...

Avoiding unchecked warning

1345 byte By FabioFranchelloa at 2007-11-27 9:34:03
Hello eveyone. I'm relatively new on generics, and I'm curious about something. Consider this code:...Vector v = u.getDataVector();for (Object elem : v) { Vector<String> st = (Vector<String>)elem; if(Long.valueOf(st.elementAt(0)) == c.getId()) {// Do your things.return; }}It works ...

Using Class<?> Class.forName() generic info

361 byte By ntalamaia at 2007-11-27 9:34:15
Hi,how do I get advantage of the generic information in Class.forName method?I actually have the code:Class<?> myClass= Class.forName(myString);and I want a generic type for myClass (let T), so that later on I can create instances of myClass using:T myInstance = myClass.newInstance();How ...

Serialization and serial communications

2136 byte By Thomas52a at 2007-11-27 9:35:07
Hello, all. Please forgive me if this is off topic, but I could not find a better place to start. If it belongs somewhere else, please direct me and I will post it elsewhere!I am trying to deveop a bit of a device that will run connected to the ethernet. I decided to begin with Dallas-Maxim's ...

Chicken and the Egg

3217 byte By nicfortin1342a at 2007-11-27 9:35:11
I have an abstract superclass (NGEntity) and about a dozen subclasses. Each subclass implements an interface (EntityInt) as to simplify the <T extends ENtityInt> generic definition.public abstract class NGEntity{...}public class NGClient extends NGEntity implements EntityInt{public ...

Is it possible to know which thread created a component?

315 byte By BHARGAVAa at 2007-11-27 9:36:22
Hi,I have two thread running, one of them opened up a model dialog and waits for user interaction. Between, I got a reference to the model dialog object in my second thread and I want to know the thread name which has shown/created this component. Is is possible?thanks in advance ...

Connection reset: socket write error

1491 byte By Goela at 2007-11-27 9:36:57
My applications are Java based Client Server Applications. The clients have been developed using Java Swings API.(JDK 1.5) The Database server is Oracle 9i. The clients are connecting to server through Oracle JDBC thin drivers(classes12.jar). We are NOT using any Connection pooling.In each of ...

How to handle large amount of data

417 byte By oh_sillya at 2007-11-27 9:37:45
Hi all,I have developed a client/server application and make use of socket to send/rcv data (data size: around 12KBytes), but I found that the input stream cannot fully read the data from server and the data I got an incompleted data. What happen with the socket and did anybody got the same ...

developing a streaming HTTP client-server application in Java

821 byte By james-mcfaddena at 2007-11-27 9:38:05
hi there.this is james mcfadden. i am planning to develop a streaming HTTP client-server application in Java. i know for a fact that i would need to develop a web browser, a web server and a media player application. i would also need to create metafiles.From what i know about the streaming ...

Requests over one socket

4784 byte By Jacquipre79a at 2007-11-27 9:39:40
Hi it's me again,I tried to implement persistent connections to our project because of performance problems - as you can see some posts ago: http://forum.java.sun.com/thread.jspa?threadID=5188706&tstart=15If a request from the client (browser) is sent to our webserver, a new ...

InterruptedIOExcpetion for InputStreamReader

397 byte By mammaa at 2007-11-27 9:39:46
I am using Server socket to read from console .In the server socket , I am reading from client through InputStreamReader.In a different method, I am opening a new InputStreamReader to process the output of os command through exec().Whenever this method calls, the other InputStreamReader gets an ...

Multithreading with Socket Connection

805 byte By tech_b_ka at 2007-11-27 9:40:26
I have a code which actually runs some number of predefined threads (More than 1). The fucntionality of the thread code is to connect to another system through Socket Connections (using IP and port) and send a request to it and get back the response from that sys through DataStreams.While ...

File does not exist after ftp downloading

515 byte By Lior_Levya at 2007-11-27 9:41:24
Hi all,I have a really strange problem.I'm getting a file from a remote server (ftp "get"), the process ends with no exceptions, but when I go to the specific directory where the file should have been - there is nothing there.I tried to get the file manually through acommand line ftp and it ...

Printing Image files

304 byte By Raj@SAPa at 2007-11-27 9:41:28
Dear Friends,Good Morning. Please help me in resolving the following scenario.I want to select file from particular location and send that file to the specified printer. Is it possible, can u guys throw some light on this. It will be more helpful.Thanks in ...

advice needed on how to approach this, passing around strings

1811 byte By lokiea at 2007-11-27 9:42:29
Hello everyone,I'm new to network programming and I was just wondering if I could get some clarification and some advice on networking.Right now I have a serversocket program that accepts a connection from another server that is sending large strings (events), my server socket program takes ...

javax.naming.PartialResultException: Unprocessed Continuation Reference(s);

13168 byte By 4tha at 2007-11-27 9:43:39
[nobr]Hello above all to you steven ;-)I get this JNDI error performing my ldap password change:javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ''The double quote above at the end of the error msg is actually 2 single quotes just to let you ...

How to put NEW LINE char in a file..?

628 byte By pissing_crowa at 2007-11-27 9:43:46
Hi all,Am writing some data to a file using File connection. Am appending all datas to a StringBuffer and finally writes into the FileOutPutStream and flushing it. Am appending new line character ('\n') to StringBuffer and it is printing perfectly on console but not in file. In file ...

send files...please,can any one help me

5725 byte By Roddicka at 2007-11-27 9:44:33
i do a simple java chatting projecti want help in sending files between client and serverthis my client and server codehow can i change in this code to achieve this pointthanks a lot for caring//Server Classimport java.io.*;import java.net.*;import java.awt.*;import java.awt.event.*;import ...

javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: ...

5650 byte By 4tha at 2007-11-27 9:44:39
Hello,thats an image of my w2k active directory ldap tree: http://img248.imageshack.us/img248/918/adwn6.gifrunning the bottom code from Adler_Steven which i chnaged with my data i get this error message:Problem resetting password: javax.naming.NameNotFoundException: [LDAP: error code 32 - ...

Sorting date using Comparator.

1571 byte By beejuma at 2007-11-27 9:45:58
Hi frnds,I have a problem sorting a date using comparator Interface. To the compare method I am passing Objects, which contains values retrieved from bean.I have hyperlinks for all the fields, upon clicking am able to sort all the fields except the date:The format of date is MM/DD/YYYY. It is ...

Problem with Selector.select() NIO

825 byte By kewljavaguya at 2007-11-27 9:47:51
Are there still issues in java.nio.channels.Selector.select() when running on solaris.It perfectly works fine in windows XP. We are able to register a selector with a channel and successfully retrieve SelectionKey. But when doing a select after registration the selection key is lost (count = 0) ...

Extending HttpURLConnection

1770 byte By MarcelSa at 2007-11-27 9:48:08
Greetings,I've been using HttpURLConnection to implement WebDAV on 1.3 and 1.4 JDK. I've now upgraded to 1.6 and am no longer able to cast from sun.net.www.protocol.http.HttpURLConnection to my extension.My custom HttpURLConnection does extend the sun class and when I retrieve the ...

Returning a Remote object at client login.

4005 byte By Strider80a at 2007-11-27 9:48:12
Hello.I have the feeling that this is a basic question which might be asked more often. But strangely I didn't find this issue in the basic RMI tutorials and a google search didn't give me anything useful too.I am making a client/server program with RMI running on java 1.6.0. On the server I ...

Content-Type URLConnection

456 byte By Lizziea at 2007-11-27 9:48:25
I need to set my content type to be XML. I used the following:HttpURLConnection urlConn = null;URL u = new URL( url );urlConn = (HttpURLConnection)u.openConnection();urlConn.setDoOutput( true );urlConn.setDoInput( true ...

Downcasting a subclass of a concrete generic

5379 byte By Liam3851a at 2007-11-27 9:50:53
Hi--Been puzzling over this one for quite awhile, and I still can't figure it out. I'm trying to downcast a generic type to a subclass of a concrete type. Now admittedly that's messy and I'd like to refactor, but I'm still puzzled. Take the following code:public class Test1<T> ...

Converting a String to Date

417 byte By beejuma at 2007-11-27 9:51:11
I have a String in which i am storing the date which I have retrieved from database. How can I convert this String to a Date object and use Comparator for sorting.String strCreatedDate1 = ((CVendorEmployees) vendoremployee1).getCreatedDate().toUpperCase();The date format which I will retrieve ...

Any example of dynamic proxy with RMI?

4711 byte By eddiecjchianga at 2007-11-27 9:52:21
Hi, are there any good example of dynamic proxy with RMI, using the new RemoteObjectInvocationHandler class?I am currently implementing a Registry, and want to use dynamic proxy to wrap around the registry stub, to pass extra information to the client.I've tried it, but the program will hang ...

Using threads and collecting responses

621 byte By faliscoa at 2007-11-27 9:52:24
Hello, I am doing multiple requests to diferent web services from diferent providers. I want to do the requests simultaneously and I think the best way is using threads. I am thinking to create a main class that creates a thread instance for every request (max 5) and then wait for the responses ...

Can java use proxy to connect internet?

103 byte By youhaodiyia at 2007-11-27 9:52:31
My program works in an intranet environment. Can I add proxy into my program to access internet?

Concurrency issue

527 byte By VishVa at 2007-11-27 9:52:35
Hi,I am working on J2EE application and using Hibernate.Application is online submission form which contains questions. User has to respond to each question. when user fills the response and click on save. Responses will be stored into response table. Now i am having problem with one user's ...

Sending content in an html page via email as body

537 byte By Shigaa at 2007-11-27 9:53:15
HiI am really in need of a prompt help for sending a web page which contains some html content as an email body.I really have no clue about this.I have tried searching in google but could not find any thing in java.I have everything ready for sending an email, i.e. to, from and subject.The only ...

RMI + SSL need help

5623 byte By lukaTNa at 2007-11-27 9:53:37
Hi,i want create a simple RMI program with SSL sockets but when i run the client i've this type of error:javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failureat sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)at ...

Garbage when Compressing a Byte array

2067 byte By Kurdta at 2007-11-27 9:53:47
Hi all guysI am sure you can help me with this, I am using jazzlib ( http://jazzlib.sourceforge.net/) ZIP library for deflating and inflating data, I was all day trying to find examples and I came with this:public byte[] compress(byte[] input) throws IOException{Deflater compressor = new ...

I can't seem to find a function to check to see if a connection was success

7802 byte By lokiea at 2007-11-27 9:54:30
Hello everyone. I'm running into 2 problems that I can't seem to find functions for after reading the java API on socket and serverSocket.If a client closed a connection on my server, like if someone telnets into my server, then closes the console, i get the following:Event from: ...

RMI Works In One Direction, But Not When Config Flipped

955 byte By EJavaM07a at 2007-11-27 9:54:40
Hi All,Interesting problem: I have an SSL-RMI server, running either as an application, or as a service using JS Wrapper, on PC-A, correctly serving content to a client running on PC-B. But when I flip the configuration, such that PC-B is now hosting an SSL-RMI server, PC-A's client is ...

Corrupt File after file transfer

2431 byte By Mjacobsa at 2007-11-27 9:55:03
I have written code to transfer two files from the client to the server. Every time I transfer the file and try to decompress it using gzip, it says "corrupt input. Use zcat to recover some data." Is there any way I can fix this? Please help...Client side:for (int z = 0; z < files.length; ...

Corrupt Files After File Transfer

2423 byte By Mjacobsa at 2007-11-27 9:55:04
I have written code to transfer two files from the client to the server. Every time I transfer the file and try to decompress it using gzip, it says "corrupt input. Use zcat to recover some data." Is there any way I can fix this? Please help...Client side:for (int z = 0; z < files.length; ...

Resorting the entries after one changes

1370 byte By _dnoyeBa at 2007-11-27 9:56:05
After some usage of my program I realized that my TreeSet is giving me problems. Its a sorted set with compareTo based on name. When the name of an entry changes I need to resort the set.I know its bad for any equals or compareTo to change after the item was put into the set. So I figured I ...

<E extends Exception> Only Compiles Sometimes (possible bug)

1930 byte By DejasPerPera at 2007-11-27 9:56:16
Consider:public interface RootedNodeAlgo<R,T,J,E extends Exception> { public R forParentNode(RootedNode<J> n, T... input) throws E; public R forLeafNode(RootedNode<J> n, T... input) throws E;}public abstract class LeafSyntaxNodeBase extends SyntaxNodeBase implements ...

Remote Desktop in RMI

189 byte By gopi.sun.coma at 2007-11-27 9:56:49
hi if any one having the coding to connect remote machine using RMI...it is possible to do it in JAVA ?because i need application like GoToMyPc...pls help

ReadLine problem

978 byte By jahanuma at 2007-11-27 9:57:28
Hi guys, I have a slight problem here. My code is simple and is as follows:import java.io.*;public class Average {public static void main(String[] args) throws IOException {double numbers = 0.0;System.out.println("Please enter 5 numbers");BufferedReader br = new BufferedReader(new ...

pinging a host

236 byte By Vive_JavaNETa at 2007-11-27 9:57:32
Hello, can anyone help me out with how to ping a host using java I dont have to use Process p=Runtime.getRuntime().exec("ping ........instead I need some powerful mechanism.. i am working on java 2 sdk 1.5.Thank you

UPD framework

245 byte By nichelea at 2007-11-27 9:57:34
Hi All,I'm looking for a good java framework that can help me with a UDP multicast application. Something like JGroup (that indeed is more that what I need) but with Apache license.Is there anything ?ThanksSte

Problem with binding when classpath contains space

434 byte By Andrei_Marchankaa at 2007-11-27 9:57:41
Hi everyone,My application has space in the path and as a result space appears in the classpath. So rmi won't work and I'm always getting MalformedURLException. Also I won't be able to change classloader for distributed object, because I don't create it directly. I use Avalon framework.If i ...

Stream Closed Error

9435 byte By domnul_mihneaa at 2007-11-27 9:58:00
Hello!I have this 2-class package which gets informations on Microsoft SQL Server 2005 tables and table content. It worked perfectly on J2SE 5. Today I moved to Java J2SE1.6 u1 and recompiled the project. Now, it triggers bizzare Steam Closed exceptions when trying to read a line from the ...

Problem with using generic methods

2456 byte By mr.hwortha at 2007-11-27 9:58:33
Hello. I'm having a bit of trouble figuring out how to correctly parameterize a function. Here is some sample code to show what I'm trying to do.interface SampleInterface<T> {}//Emulating a set of SampleInterfaceinterface OtherSampleInterface<T extends ...

java.rmi.ConnectException: Connection refused to host:

2160 byte By Sopha at 2007-11-27 9:58:50
HI,I have both RMI client and server in my machine.i started the server successfully withC:\Documents and Settings\benedict\workspace\RMIDemo\bin>java -cp C:/"Documents and settings"/benedict/workspace/RMIDemo/src;./;c:/"Documents and settings"/benedict/workspace/RMIDemo/bin/compute.jar ...

methods accessiblity restrictions

2287 byte By emeraldcpa at 2007-11-27 9:59:08
I am confused about some examples from Angelica Langer FAQ regarding method accessiblity.class Box<T> {private T t;...public int compareTo(Comparable<? super T> other) { return other.compareTo(t); }public Box<? super T> copy(){ return new Box<T>(t); } }public void ...

Callable interface

1882 byte By emeraldcpa at 2007-11-27 9:59:09
I am leaning concurrency programming in jdk 5, and ran into trouble with Executor framework, actually, it's a generic type problem.I want to use Executor.invokeAll to execute a collection of tasks, the signature of this method is:<T> List<Future><T>> ...

cuncurrency issue using ArrayList

716 byte By mullapudia at 2007-11-27 10:00:07
Hi allI have an arrayList object, 10 threads are populating data in to that arrayList object, another main thread will fetch data from that object. I am using iterator object to run the while loop with hasNext() method to fetch data in that main thread. but if that main thread runs before the ...