Why cant we add objects to an ArrayList after the ierator() method has been called, but in LinkedList we can?
4285 byte By
Tamimia at 2007-11-27 6:35:28
Hello, I'd created a Jsp file that require an ECHO service from RMI server, the contents of my jsp file is:<%@ page session="false" import="pack.jsp.*, java.rmi.Naming.*, java.rmi.*, java.security.*;"%><body bgcolor="white">JSP TEST2<%try { ...
Hi All,Im trying to read a csv file, break the lines by comma, then store them and sort them.I have the test code working from: http://java.sun.com/docs/books/tutorial/collections/interfaces/order.htmlI am reading the file, but when I System.out.println() I keep getting the last line of the ...
1950 byte By
McNeppa at 2007-11-27 6:36:42
I'd like to share my idea of extending java.lang.annotation.TargetHere's an example that illustrates what I'm thinking of:I have designed a class Enumerable that is a kind of "extendable enum" class, making it possible to register instances of a derived class with their superclass. (It is ...
1400 byte By
DwightKa at 2007-11-27 6:37:23
Hello,I have a program that is comprised of 3 tiers: client, gateway, application server.I am trying to achieve the following:The client opens a connection on port 80Gateway accepts the connectionGateway determines which application server is handling this clientGateway opens a client ...
793 byte By
sim085a at 2007-11-27 6:38:00
Hi,I have just completed the chapter about 'Channels' in the book I am reading. I was completely new to these since I had never seen them or heard of them before! Thus I am feeling quite confused on when these should be used and why!Basically each time I asked networking question I always got ...
I was trying this simple program to run some test...package com.jpmc.ibtech.hycee.base;import java.io.IOException;public class TestThread {/** * @param args * @throws IOException */public static void main(String[] args) throws IOException { (new Thread() {public void run() {try {sleep(8000); ...
Hi, I've been working on a client/server project based off of the KnockKnock Server/Client example (multiclient one) and I'm wondering how I can make it so that both sides don't wait around for input before doing anything else. Currently, since I've followed the example and done something ...
using apt i have embedded compile-time checks for particular relationships, e.g. AnnotationA exists (only) on ClassB, AnnotationC exists on subclass of ClassD, ClassE has 0..n refs to ClassF, ClassG declares AnnotationH, ClassI has 0..n fields/methods annotated (by), etc.with a declarative ...
Hi,I've designed this small application. I want to know if there are some chances of race conditions, deadlocks or memory leaks in it. Please give your comments.The problem is that I need to do some task that takes about 3 minutes to complete. The same task can be submitted by multiple ...
Hi all,I am using the Arrays.sort method to sort files by their size.I am using a size comparator to do this.I would like to know how efficient could this be assuming large file sizes.Thanks & Regards Hemant
10046 byte By
JDvlpra at 2007-11-27 6:40:45
I have written an NIO server which gets data from a Static queue and sends it to the clients... (this is my intention.. but the server doesn't)...The problem is the server sends data to one client... and if another client is connected, the server sends data to the latest client and stops ...
1440 byte By
lokiea at 2007-11-27 6:41:14
Hello everyone.I'm not sure what data structure I should use for my particular problem.This is whats going to be happening.I'm writing a SocketServer, its going to be receiving 1000's of strings of random length. Each string is going to have an integer which can be any number, for instance ...
I want my program to monitor a file or directory. whenever the file or the directory is modificated, it will send an event to my program.I use a thread to check the last modification time ever 5 seconds, but i don't think this is a good design.
89 byte By
kim@skya at 2007-11-27 6:41:52
Hi,any one can help me to change my ip address using java instructions. plz
Hi.I'm trying to solve a problem using generics, but I cannot seem to make it right. What I want is to define a relationship between a map's keys and values using generics.The idea is to have a mapping of events of various types to event handlers. For instance given the interface:public ...
Hi All,We have an application which basically has been developed using core java. Here is a high level information about the application:a) It opens a serversocket which allows clients to connect to it.b) For every new client connection, a separate thread is created and this thread deals with ...
440 byte By
lokiea at 2007-11-27 6:43:24
Hello everyone.I was wondering if anyone really found a nice book on Java network programming. I just started a co-op and over the last 4 weeks I've been teaching myself Java from a C++ background. But I haven't been able to find many resources online that really went into detail. They are ...
Hello, i have a problem,i have an URLConnection to send some data from an applet to a servlet, i need NOT to have timeout but the connection is giving me a timeout, i'm using java 1.5 so i did this:URLConnection servletConnection = ...
Hi,I want to send HTTP DELETE request using HttpURLConnection to remove a file from the IIS web application. I do have write access to IIS web application. But I am getting http error code : 501 ( NOT IMPLEMENTED ). Is there a way to enable HTTP DELETE on IIS ?Regards,Dipak ...
Hi All,I need to find the java packages available in the jar file. I thought of doing this like this. I traverse through the directory, and if a directory has a .class file, then i can form the package structure by finding the parent. But the problem is ZipEntry doesn't seem to have any method ...
Does anyone know, why I get a NullPointerException in the linewhile (length = in.read(BinaryBody)) != -1)?byte[] BinaryBody = new byte[8192];InputStream in = method.getResponseBodyAsStream();GZIPOutputStream gzipOut = new GZIPOutputStream(client.getOutputStream());int length;while ((length = ...
3453 byte By
lokiea at 2007-11-27 6:44:20
Hello everyone. I was just trying to run some simple Source Code from my book here:package mapa;import java.util.HashMap;import java.util.Map;import java.util.Set;public class MapTest {Map<String, String> phonebook = new HashMap<String, String>();// constructorpublic example2(String ...
Hi,When using hprof or any profiling tool, the hotspot vm crashes and generates the following file. How do we read this file or make any sense of it. Is there any utility, etc..We are using hotspot jvm 1.4.2_12. Any help will be appreciated. BTW here is the latest hs file. ## An unexpected ...
A project I am working on was getting a socketClosedException so when doing a packet trace we saw that the last packet before the exception was an HTTP 100. We noticed it was using IIS 5.1 when previous testing had been done on IIS 6.0. As a test, we tried using jrockit, which was being using ...
import jav.net.*;import java.io.*;import java.util.*;import java.awt.*;import javax.swing.*;import java.awt.event.*;public class inet extends JFrame implements ActionListener{public JButton ok;public JTextField host, ip;public JPanel prim;public JLabel ho, i;public inet(){ok = new JButton("find ...
8540 byte By
lokiea at 2007-11-27 6:47:23
Hello everyone...odd problem. I just broke up this code into classes so its not all in main() but now its not working properly.Before I did this, I could telent into whatever port the serversocket was binded to, like: telnet localhost 8008 and I could type in a message, it would spit out the ...
I am writing an address book and when you change the name of a contact, the old file needs to be deleted. I am writing this using eclipse running on an Ubuntu 6.06LTS box. When I try to delete the file using .delete(), it is unable to. Using .canWrite() returns the file as being write ...
1770 byte By
Holoda at 2007-11-27 6:49:04
This is my method:private static BufferedReader readFileWithBufferedReader(String filename){FileInputStream fis = null;InputStreamReader sr= null;BufferedReader r= null;try {fis = new FileInputStream(filename);} catch (FileNotFoundException ex) {ex.printStackTrace();}//fis catchtry {sr = new ...
Hello everybody,I begin to work with java.nio. Here is description about my program: The client open one connection to a site, using NIO ( SocketChannel, configureBlocking(false) ). After finish connection, the client send request to server and wait for read data. After reading (read to the end ...
Hello everybody,I begin to work with java.nio. Here is description about my program: The client open one connection to a site, using NIO ( SocketChannel, configureBlocking(false) ). After finish connection, the client send request to server and wait for read data. After reading (read to the end ...
Hi, I am working on a hnd project which has a JFrame that contains textboxes and labels, the textboxes are filled with information from other class attributes, was wondering hoe to save the information on this screen to file.Thanks
297 byte By
lasjaka at 2007-11-27 6:50:33
I've created a List<?> list; but when I want to add any object for ex. list.add(new Integer(5)); there's an error 'The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Integer)'How should I add objects to this kind of
I've got a strange problem where a synchronized(x) appears to be holding the monitor for "x", even past the end of the synchronized code block.The basic structure of the code looks like this:Running in a "Processor" thread:(class-instance-level variable) "queue"run(){while(!stopRequested){Item ...
hi all,i am making an application in which i am receiving live data from from server and i am storing that data into hashtable through one thread then i am reading data from the same hashtable through another thread and wans to display upon applet now the problem is that i am getting Exception ...
I have a collection of Objects of a Class, this Object contains another collection within it. i.e Class A contains a collection of Class B objs.Now I want to sort elements of Collection B and based on its probability sort collection A ......I have an object C of same type as obj B of same class ...
Lets say I'm using reflection to walk over a class' methods. I come upon a method and get its return type, lets call it "returnType". Let's say "java.util.List.class.isAssignableFrom(returnType)" is true. What I'd like to know is what is the upper bound for E in List<E> for this ...
I've configured Tomcat to run with -XMs1024m -XMx1024m, and am interested to know GC performs when the -XMs and XMx are the same value.Would it generally be better to have a lower -xms value?
Hi everybody.While JMX has a great way of communication towards the MBeans through the use of high level interfaces, the notification mechanism is only available through a pre-determined interface (the NotificatioListener) that support only the passage of some pre-determined information such as ...
I have been working on trying to learn how to use Comparators to sort Collections... In one of my recent experiments, I tried to order a PriorityQueue of String elements alphabetically, in ascending order, with one exception: any word beginning with the letter "z" should be given a higher ...
7979 byte By
xpantaa at 2007-11-27 6:53:00
Hi, I am attaching some code because I am desperate.I have a ThreadedAction which is called when I click a button that brings data from a Database. The Data are inserted into a Jtable. Sometimes I get some mysterious exception I can't catch.class ThreadedAction extends AbstractAction ...
809 byte By
ducotta at 2007-11-27 6:53:18
So I'm making a plug-in for eclipse with which I want to automatically generate test stubs for each of the public methods and constructors of a class. The way the plug-in works, you right click on the file in the navigation pane. At this point, java has created an IResource object to store the ...
Hi Guys,I am running jdk1.5.0_06 on Linux. I have added the system property com.sun.management.jmxremote for my Java Application, but when I run jconsole <pid> it gives me the error:Unable to attach to 25837: Could not map vmid to user Namehere 25837 is the PID of my Java Application. I ...
940 byte By
jelaloa at 2007-11-27 6:54:25
hi all,I am about the build a multi client application using RMI. I am not going to explain all the details but it will be something like:think about a server which all clients will try to connect in the first place. this will be a class, implementing a remote interface and accepting ...
Hello.Maybe someone can help me on this because I have tried already everything.Basically we have an application that after running about for 3 weeks it reaches a state of "Out of Memory Error" and stops functioning. I tried to compare dumps of JMAP tracking out every day that passes but ...
Hello.Maybe someone can help me on this because I have tried already everything.Basically we have an application that after running about for 3 weeks it reaches a state of "Out of Memory Error" and stops functioning. I tried to compare dumps of JMAP tracking out every day that passes but ...
3531 byte By
kimilea at 2007-11-27 6:55:21
HiI notice a behavior in the Introspector.getPropertyDescriptors() that i qualify has a bug.The problem occurs when i create a bean that as a property with a letter in lowercase followed by one in uppercase and what ever you want next. Something like xBlalala.When using the Introspector to get ...
Dear,I've a program that query some user account information from A.D.But I don't want to hard code anything.I've read some previous post about using LDAP, and using DNS queries to found all LDAP server of A.D.But how can I get the A.D. domain name in Java?for example ...
Hey,I'm busy with an applet and need to delay 2 method calls.the first method needs to be executed immediately, and the other has to be executed after, say 5 seconds.Method: public void setRed(){canvas.setAmber();try {Thread.sleep(2000);}catch (InterruptedException e){e.printStackTrace(); ...
Hello all,every now and then I need the mathematical set operations "intersect", "unify" and "subtract". It's no big problem to implement them where needed, but I wondered if there is an official version in the Java-API. This would be especially useful in the Set classes, but I couldn't found ...