Java-index »» Core »

Need help making this class Runnable.

1739 byte By arsia at 2007-11-27 7:34:54
Hello,This class (see below) is working fine the way it is but I have a little problem, I need to execute aprox 500+ commands and each command takes between 30sec to 3 minutes to complete which translate into hours for the job to finish.I want to speed the process by multi-tasking and executing ...

TreeMap error

870 byte By ThrowCodea at 2007-11-27 7:35:11
I have several TreeMap classes in the app I'm working on and one is acting funny. The Class I'm 'putting' into the Map includes Integer, Strings and Calendar objects. After loading the Map I go through the keys (integer values) loading the values to a table control and find that all of the ...

RMI PROBLEMS (CAST)

2987 byte By lifesuna at 2007-11-27 7:35:16
I have this exception :java.lang.ClassCastException: Prova.Types_Stubat Prova.Types_Stub.metodo(Types_Stub.java:36)at Prova.Client.connessione(Client.java:25)at Prova.Client.main(Client.java:47)The Source Code is : package Prov;import java.rmi.*;import java.rmi.registry.*;import ...

Wait until file updated

346 byte By txatia at 2007-11-27 7:35:30
Hi,I have to read text (lines) from several files, and after that, I have to wait until new information is written to the file (as log files). The new data should be processed as it comes (in real time).how can I wait until the new information is written?The goal is not to make a sleep() of ...

Help with Java Chat

17337 byte By julsorioa at 2007-11-27 7:35:42
Hello everyonei'm trying to develop a Java Chat,i've been using source code from another chat to personalize minethe interfaceimport javax.swing.*;import java.awt.event.*;/** * * @author Juli醤 Osorio Amaya */public class InterfazChat extends javax.swing.JPanel {JButton jButton1;JScrollPane ...

URLClassLoader interprets path as package

3007 byte By MarkusKuhlaa at 2007-11-27 7:36:27
Hi,I have to load a class from another directory. This class is in no package! I specify a path for the URLClassLoader but the compiler interprets this as package for the class and of course complains that the package is wrong.the code:public class Main {public static void main(String[] ...

Java Chat Username Registration Error.

285 byte By KKera at 2007-11-27 7:36:44
Okay, I've been developing a Java chatroom, and I want to, when someone enters the chatroom, have the user register his username with the server. When I do that, it lets people know who's in the chatroom. Whenever I try it, it makes some crazy unstoppable loop of foreverness.

Insufficient System Resource to complete the requested request

554 byte By Lets_Make_it_Simplea at 2007-11-27 7:36:59
Hello All,I have installed jdk1.4.2_06 in different windows boxes. I am running the same java program in both the boxes. For box#1 it is throwing the above error while copying a file bigger 64M, but, for the box#2 it is throwing the same error when the file size is bigger than 32M.I tried to ...

How to know whether a file is open?

94 byte By youhaodiyia at 2007-11-27 7:37:13
I want to get whether a file is open to be written by other program. How can i do that?

Server stress testing tool

1124 byte By jimfixera at 2007-11-27 7:37:17
Hi all,I have been developing an application to do a stress test on our Instant Messenger server. This application must check if server can handle 1000, 10,000 or 100,000 connections concurrently.- Server is developed by using socket, it will create a new thread everytime it receives a incoming ...

hi i need help,

332 byte By acharia at 2007-11-27 7:37:37
Hello, i am trying to write a program in which i need to know the names and ip address of all computers connected in LAN. previously some one help me to do this. but unfortunately i lost my all my back up so please send me atleast any reference so that my requirement will be fullfilled.thanking ...

Client/server application (Help me)

762 byte By Iftia at 2007-11-27 7:37:57
I have a client server application.In the client part i send data to the server and the server receive data. After receiveing data server also send some data but the client can't capture data. Anyone please tell me what is the problem?I am giving the sample code here......I am thinking ...

RMI Exception : java.lang.NoSuchMethodError

738 byte By lifesuna at 2007-11-27 7:38:13
I've received this Exception :Exception in thread "main" java.lang.NoSuchMethodError:stub class initialization failed at : CLASSE_Stub.<clinit> <Unknown Source>I start the registry with : rmiregistryI compile all the -java : javac *.javaI create the stub with : rmic CLASSEbut when ...

New in Generics

765 byte By Jensona at 2007-11-27 7:38:17
Hi Guys,Sorry if my post irritates you or seems annoying. But I'm just a beginner learning Java Generics and I really have difficulties understanding Generic Methods and Interfaces (not Generic Class though). I read the Anglika's FAQ on Java Generics, however, it's stated that it's not ...

network monitoring

470 byte By SandeepSirohia at 2007-11-27 7:38:36
Hi,I want to check all incoming network request to my system, and finding information about the clients who are trying to access my system (i.e. their IP Address etc.).Like whenever a user access my system my application should be able to track that request.But I am not able to find out how to ...

Distinguishing between READ and WRITE synchronized?

1190 byte By Aconcaguaa at 2007-11-27 7:39:03
Example: highly multi-threaded application, but almost all threads use a common resource - read only in most cases.In some rare cases (few in number and occurrence), however, the resource can be modified by a single thread. So the resource has to be synchronized, with the result that only one ...

how to get the IP address in linux using java

216 byte By nandashivaa at 2007-11-27 7:40:14
hi i have an application which returns an Ip addess .The problem is it giving the valid IP address in windows but in linux i am getting invalid IP address please help me outthanls

Unblock threads

635 byte By tlloretia at 2007-11-27 7:40:22
What do you think about using this code to add a control to Unblock BLOCKED threads each 15 mins for example?Vector runningThreads = RunningThreads.runningThreads;logger.info("runningThreads"+runningThreads);for(int j=0;j<runningThreads.size();j++){SearchUSPTOThread t = ...

Memory problem in Java service

1075 byte By avsia at 2007-11-27 7:40:46
I have an application which listens on a port and when it receives something runs a process (using the same port) in a new thread. The application runs as a windows service so I'm using a socket timeout to force the loop to keep evaluating rather than just blocking to allow the service to be ...

help on java multicast!!

206 byte By vdga at 2007-11-27 7:40:58
hi !!I am working on a group chat and having a problem with multicasting the message to all the sockets ...how to create a stream for each of the sockets?plz help me i have very little time ..

Interview Ques

279 byte By relaxedgalaxya at 2007-11-27 7:41:14
Hi, Im kinda new to RMI, i was asked in an interview recently What are things i need to keep in mind while designing an RMI application, as in what needs to be taken care off while putting a server object in the RMI registry?Can any1 help me with this.Thanks

How to authenticate using Active directory!

4075 byte By vijayvignesha at 2007-11-27 7:41:19
Hi all!at present im using a code given below, its working fine! currently we are using mixed mode active directory! we are going to migrate that to Native mode!import java.util.Properties;import javax.naming.*;import javax.naming.directory.*;import javax.servlet.http.*;import java.io.*;import ...

Problem in PortableRemoteObject

687 byte By c.anejaa at 2007-11-27 7:41:35
Hi i am getting this error while making Session bean.I think its not getting a proper object in lookup.java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)Code is like this:InitialContext ctx = new InitialContext();Object ...

return byte array

1338 byte By JusteUneQuestiona at 2007-11-27 7:41:43
Hello i have a function that return a byte array. I did it this way but i m wondering if it is the good way, so if someone can help improve it. Thank you. try{InputStream is = new BufferedInputStream(new FileInputStream(nomFichierDemande));byte[] readData = null;while (is.available() > ...

Timer.schedule() throws RuntimeException and getMessage() is a long?

3300 byte By lmimmfna at 2007-11-27 7:42:28
Hi,im using JDK1.4( i know old ), but when scheduling a task with a Timer( isDaemon=true ) its throwing a RuntimeException, im using these to kick off timers for timeouts for sessions, i.e. in the below case idle timeout and each session has its own instance of MyTimeoutTimer( ive dumbed down ...

ClassNotFoundException

650 byte By ACVa at 2007-11-27 7:42:31
Hello,Can anyone tell me why when I try to register the RMI Server the following runtime exception occurs:========================java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:java.rmi.UnmarshalException: error unmarshalling arguments; nested exception ...

SSL socket blocks on close

2874 byte By raykroekera at 2007-11-27 7:42:46
I am using an ssl socket connection with a long lifespan. I'm using it to receive event information from a server. My problem occurs when the client os's underlying network connection drops out and comes back. When it re-appears the application re-establishes the event socket connection, by ...

java cmd line parsing

251 byte By jpgthora at 2007-11-27 7:43:31
Does the Java Core API contain a class/object for simple command line argument / options parsing? If an class exists in the core API, can anyone point in the right direction? If not, can anyone suggest a simple and useful 3rd party API? Thanks!

Thread question

818 byte By tlloretia at 2007-11-27 7:43:43
Hi,from my thread i call an external perl program like this:String [] cmdStr = {"perl", Constants.workingPath+ File.separatorChar +"scripts"+File.separatorChar+"get_document.pl", urlPath, database, busquedaFile, Constants.patentesPath};int exitCode =-1;Process ...

Multicast with more NICs

959 byte By manfy74a at 2007-11-27 7:43:44
Hello, I have an application which sends and receives multicast messages. It works fine, but now I have to change it to support more network interfaces. From one interface I will get response, from others not, but I don't know in general which one is the right one.I tried it with creating a ...

Appending to an existing Object serializable file generates an error

749 byte By S.Aa at 2007-11-27 7:45:03
hi, every oneI am writing objects to a file using ObjectOutputStream but I need to close it from time to time and then open it again and append objects to it.I have been using the following to open the existing fileoutput = new ObjectOutputStream(new FileOutputStream(fpath,true));then when I'm ...

chat messenger

386 byte By aman_mahajana at 2007-11-27 7:45:11
Hi,I want to create a small chat messenger within my small organization of 10 ppl. I know it can be done via networking but how to proceed on this i dont know.Please throw me some ideas on that 1. What is the logic behind chat messaging. How Java networking helps in that case?2. How to start ...

Need help to fix an API Issue with captured wildcards

3399 byte By Henri_Tremblaya at 2007-11-27 7:45:19
Hi,I just felt on a problem with captured wildcards for which I understand what's wrong still can't see how to fix it. So I'm here asking for help. Here's the test case:import java.util.ArrayList;import java.util.List;import org.junit.Test;import static ...

RMI Exception

3304 byte By Sutha at 2007-11-27 7:45:21
I'm getting an ExportException coming from one class (SGJmsWriter) but not from the other classes I have that are basically the same thing. I've looked all around for a resolution to this problem, and I solved one problem where I hadn't called connection.start(), but I still have this one. ...

LDAP?

61 byte By AdrianHBKa at 2007-11-27 7:45:52
Is there any sample program for me to try out on LDAP?

Optimized Syncronized list?

716 byte By ibanna at 2007-11-27 7:48:55
Recently i noticed that Collections.synchronizedList(List) implementation was based on a "simple" synchronize block wrapping delegated calls to original List.This suprised me as i was expecting something better than Vector implementation. (which is also based on synchronized blocks).In my ...

Avoiding hard-coded annotations such as below:

493 byte By balteoa at 2007-11-27 7:49:51
Hello,I would like to avoid the hard-coded annotation variable such as below:@Table(name = "CALYONQA.TheTable")public class etc...Environment:-J2ee 1.4 (web tier only, tomcat 5.5)-J2se 5.0I have a context param which is located in the web.xml and that I would like to use instead of the ...

LDAPS certificate location

696 byte By Yeva at 2007-11-27 7:50:30
Hello,my program does ldap serch. Without LDAPS everything works great, but as soon as i am trying to use LDAPS IBM virtual machine keeps saying that certificate is not trusted (meaning that it can't fidn trust store) and Sun comlaines about invalid signamure. I can do my custom factory, but i ...

Noob synchronization question - updating static member data reference

1795 byte By MePacoa at 2007-11-27 7:50:57
I have a class with some static member data that is used throughout the code. Nothing modifies it so I haven't had to worry about synchronization. However, now I want to be able to change it at run-time and I'm not sure what all needs to be done. Here is an example of the type of thing I'm ...

AutoProxy with HttpUrlConnection

209 byte By meetaa at 2007-11-27 7:51:00
Hi,How do i use autoproxy with HttpURLConnection?I tried using the system Properties http.proxyHost and http.proxyPort, but it did not work, i still got a connection timeoutPls help

How to bind a thread to a CPU explicitly in Java

190 byte By yang2007a at 2007-11-27 7:51:48
HI everyone,My question is how to bind a thread to a CPU explicitly in Java on Linux operating system. If anyone get the answer, please let me know. I appreciate it.yang

HttpUrlConnection, URLConnection, and Sockets for HTTP

302 byte By Arash.Shahkara at 2007-11-27 7:51:53
Suppose we want to send requests and receive documents over HTTP frequently. Is establishing direct connections and manually sending HTTP request by using Sockets faster than simply using a HttpUrlConnection instance?What if we want to establish persistent connections (HTTP Keep-Alive) ...

convert file from unicode to ansi

264 byte By Keviva at 2007-11-27 7:51:59
Hi,After i read-in a file using FileInputStream, 1. I need to detect if its in UNICODE format. How to do that?2. If it is, i need to convert it into ANSI so that i can parse it later on.Any hints/solutions?Thanks,-V

Combining generated IDL and ORB implementation from different vendors

721 byte By seacuke23a at 2007-11-27 7:52:10
I have been working on a project with another company. The project involves me writing a client to communicate with their server via CORBA. I'm using JacORB and they're using the Sun ORB. We've had some interoperability issues and their solution is that we both use JacORB with IDL compiled ...

Generics and reflection

1118 byte By AdrianSosialuka at 2007-11-27 7:52:17
Hi everyone,I have just started going through reflection's API andI am positively surprised that I can retrieve all the informationregarding generics despite erasure ! That makes me feeleven more dizzy ..... a) Why can't I .......b) Because of erasure ....a) Why do we need erasure ?b) For ...

Server e thread

500 byte By PremierITAa at 2007-11-27 7:52:23
In my application i would create a multithread server.When i launch the server, it listens on a port (with accept method) and i must manage it from consolle.While it manages the connection in by client, i must can controll the server from the consolle, such as see how many connections are ...

Warning in getConstructor() in Java 6

417 byte By Pavel200a at 2007-11-27 7:52:29
I'm having compilation wornings after I switched to Java 6 in the following code:Class cls = ...Constructor constr = cls.getConstructor(Long.class, Date.class);warning: [unchecked] unchecked call to getConstructor(java.lang.Class<?>...) as a member of the raw type java.lang.ClassWhatever ...

How to handle inner objects on deserialization

1727 byte By daniel@GERa at 2007-11-27 7:54:49
hi at all,it's my first post, so i'll make a short introduction:I'm a 23 year old german studying Information Systems.We are running a training on developing software (a small auction system like ebay ;-))Now to the problems i've been running into concering serialization:We've for every ...

Class<T> where T uses generics...

2035 byte By ushaca at 2007-11-27 7:54:52
Hi all!Maybe this has been discussed before, but if so my searching skills must suck. A pointer to where would be much appreciated. Anyway, to my problem...Knowing that you can't directly create an instance of a type parameter, like new T(), i create an interface like this:public interface ...

Is PrintWriter buffered?

433 byte By DMJasona at 2007-11-27 7:55:14
I have been studying for the SCJP exam and began wondering if PrintWriter is buffered. From what I can tell in the javadocs it seems to imply that it is; however, I keep seeing developer code that wraps a BufferedWriter.Not that it matters for the exam (it can be done and that's all I need to ...