Java-index »» Core »

udp client: destination port unreachable question

641 byte By vl_a at 2007-11-27 6:13:35
Hello,I used "trivial" UDPClient / Server example to send datagrams from one local interface (eth1) on my Linux box to Datagram server on yhe host not included into local routing table and I tried to capture outgoing udp traffic on interface eth1. I've got IOException"ICMP: destination ...

Iterating an ArrayList Collection

588 byte By flaaba at 2007-11-27 6:14:02
Hi =)I'm kinna newbie to Java so sorry if it is to stupid.I'm correctly receiving a Collection from a Method. Like this..Cliente arturo = new Cliente(47451001);Collection reservas = arturo.getReservas();It's an ArrayList Collection. Now I would like to iterate over it to perform something ...

NoClassDefFound while trying to run program

1866 byte By beginner_Ricka at 2007-11-27 6:14:25
Can anyone please tell me what is wrong with the following program?class Vehicle{String name;double capacity, efficiency, miles;static int noOfVehicles;Vehicle(String n, double cap, double eff, double mi){name = n;capacity = cap;efficiency = eff;miles = mi;}Vehicle(){noOfVehicles = noOfVehicles ...

problem with MySQL SERVER

267 byte By nitin.vatsa at 2007-11-27 6:14:44
Hi,I am facing a problem, I want to update tables that is in my local host server which is now I m using Access , and i want to update my values in server database which is MySQL, is dere any option to do dat...please help me out of dis problem...thanks

How to do SCP using JAVA code from windows machine to Unix

184 byte By Mitsa at 2007-11-27 6:14:51
I want to transfer text file from windows machine to UNIX using only SCP(Secure Copy). i know using WinSCP i can do that . but i want to know how can i do using JAVA Programing.

Compile-Time Reflection/Metadata access?

400 byte By TeamRabidDoga at 2007-11-27 6:14:52
Hey I hear for netbeans there is an extension (or maybe it is built in) to do reflection/access metadata at compile time.Anyone hear about this or know where I can find more info on this? Or maybe it is for a different IDE or a stand alone tool?compile-time access would be ideal since J2ME ...

Creating an ArrayList iterator from scratch

9159 byte By ShiggyMotoa at 2007-11-27 6:15:23
I am having trouble understanding how iterators are supposed to be implemented in a working program. I am trying to make an ArrayList that I can iterate through and supports wrap-around. I'm not sure if the methods are one-hundred percent correct since I can't even get a working driver to ...

close Client

215 byte By argola at 2007-11-27 6:15:52
how to close client to dont get java.net.SocketException: Connection reseti dont know why Telnet conection is okI know that i close socket i wrong order but how to do this properly

Sorting data from a csv file

1495 byte By iketurnaa at 2007-11-27 6:15:58
Hi All,I currently can read a csv file into my console using:BufferedReader in = new BufferedReader(new FileReader("/Users/Admin/Desktop/list.csv"));int numberOfRows = 0;int numberOfColumns = 0;String line;while ((line = in.readLine()) != null) {System.out.println(line);if(line!= ...

Going back in an input stream

630 byte By apintoa at 2007-11-27 6:16:21
Hi there,I know this thread topic seems a bit non-sense, but I just can't figure how to do what I need... And what I need is to make decisions in the current input stream bytes based on future bytes.I know all about mark() and reset() methods, but they just don't work one any InputStream, and ...

How do I recover the actual type of the this object in a class hierarchy?

1960 byte By AdrianSosialuka at 2007-11-27 6:16:26
Hi,This is code snippet from Angelica Langer's FAQ:abstract class Node <N extends Node><N>> {private final List<N> children = new ArrayList<N>();private final N parent;protected Node(N parent) {this.parent = parent;if(parent!=null)parent.children.add(this); // error: ...

Problem with downloading file from FTP server

1085 byte By flightcaptaina at 2007-11-27 6:16:27
Hello allI have uploaded a file from an application i developed and i want to download this file from another application. The code is public static void FTPcon() throws FtpException{String hostname = "my.ftp.server";String username = "myusername";String password = "mypass";Ftp ftp = new ...

View inherited's members from a superclass method

2580 byte By sand_draxa at 2007-11-27 6:16:30
I have the following classes:Father.javapackage mypackage;import java.lang.reflect.Field;public class Father {protected String name;public String getName() {return name;}public void setName(String name) {this.name = name;}public void examine() {Class me = getClass();Field[] fields = ...

Question on Generic Method/Constructor & inference

1443 byte By Thomas.Mathewa at 2007-11-27 6:16:40
Can anybody please give a scenario to the following question?When to explicitly specify the type argument for a generic method or constructor?Consider the generic method show() in class Test:class Test {<U> void show(U u) {System.out.println("u = " + u);}}This method can be called as ...

Unknown ArrayIndexOutOfBoundsException

2555 byte By Gilotina at 2007-11-27 6:17:52
Hi,I have a swing application with JTable running on JDK1.6.0.It has been getting exceptions but I can't find the error source(file name and line number).Can anybody help me how to solve this problem please.Thank you in advance.Exception in thread "AWT-EventQueue-0" ...

JDK 6 on Red Hat keeps hanging

305 byte By Jamwaa at 2007-11-27 6:18:21
Hi. I have installed j2sdk6.0 on my Red Hat Linux 9.0 box. However, applications that I run (for instance my prevoius applications and NetBeans 5.5) hung unexplained in the middle of use. There is no error report and I have to kill java and start all over again. Is this an incompatibility ...

how to set proxy?

204 byte By Vive_JavaNETa at 2007-11-27 6:18:24
Hello! I want to set a proxy in a java Applet. how dp i do it?when i used System.getProperties().put("proxySet","true");It showd me an error. can anyone please tell me how do i do it?

Performance : ArrayList against Vector

222 byte By pandev84a at 2007-11-27 6:18:34
Hello frnds,If perfer Arraylist than vector then, is there is any increase in performance.. ?or should i go with the Vector ?i am so confused ...plzzz help me.best regards,Pandev84

terminalserverprofilepath ActiveDirectory

277 byte By Troubya at 2007-11-27 6:19:08
Hey,Is there any way to set 'terminalserverprofilepath' attribute in ActiveDirectory through JNDI?I understand that Microsoft had silly ideas making this attribute binary or something... any way of doing this?Thanks in advanced,Asaf.

Serial Port

573 byte By monk3ya at 2007-11-27 6:19:17
Ok , i've asked this question b4 and i don't think i was that clear on my line of questioningI've spent the last 4 days researching on how to get around this problem with no luck. I want to access a clients serial port through my server. My server brings up a browser application(Ajax) when ...

How to get reference to the object which created another object?

397 byte By quereinsteigera at 2007-11-27 6:20:16
An object is created from another object. The child object does not know anything of its parent by normal Java means.But I need to get from that child a reference to the object which created it, no matter if the child contains a reference to its father or not.Is this possible with reflection? ...

Secure Inet Connection

229 byte By schooltiger@walla.coma at 2007-11-27 6:20:43
Hi all,I need a functionality that the ServerSocket accepts only if the Socket Inet Address matched with the given InetAddress. It should be done before accept() in server socket.Thanx in advance.Tiger

Redesigning the Collections Framework

9478 byte By diku.hma at 2007-11-27 6:21:01
Hi!I'm sort of an experienced Java programmer, in the sense that I program regularly in Java. However, I am not experienced enough to understand the small design specifics of the Collections Framework (or other parts of Javas standard library).There's been a number of minor things that bugged ...

Deserializing an ArrayList string

501 byte By wilsonTech_Ricka at 2007-11-27 6:21:09
My goal is to create a function that creates a string from an ArrayList, which I can easily do in many ways. Then the caller needs to reconstruct that ArrayList, which is where I'm having trouble. Does there exist a function to do that -- to go from the serialized ArrayList string to the ...

ClassLoader problems

989 byte By duomaxa at 2007-11-27 6:21:54
I'm trying to dynmically load some junit classes and I'm having a serious problem. Loaded classes have null values. Meaning the Class is found and created, and is not itself null, but all of it's members are null (such as method names). Currently, I'm using the TestCaseClassLoader from ...

Problem on downloading a zip file

2896 byte By helenhelena at 2007-11-27 6:23:20
I am having a problem on downloading a zip file(file size is about 2Mb). Sometimes I can get a complete file and can open the file, sometimes the zip file is chunked(the file size is smaller than the right one), so I can't open it. The file content is stored in a blob field. The code first ...

Changing timeouts on both the Client and Server side..

1023 byte By detaylsa at 2007-11-27 6:23:46
Hi!I am having trouble figuring out how to change the timeout that occurs when a server vanishes and the client, which has not yet been sent a JMXConnectionNotification, unwittingly executes a method such as mbsc.queryNames().My code can currently wait as long as 120 seconds before a ...

Printing out HashMap sorted

3275 byte By iketurnaa at 2007-11-27 6:24:05
Hi All ,trying to sort a HashMap then print it to a file.I have data like in a csv file:Full Name,Email,Phone,Street Address,City,State,ZipJames Madison,jmadison@whitehouse.gov,201-555-1234,12 Main Street,Newark,NJ,11346theodore roosevelt, teddy@whitehouse.gov, 415-555-1234, 1239 Geary, San ...

Generic Usage in Collections Framework

1096 byte By ThomasOwensa at 2007-11-27 6:24:09
I'm confused about these methods:public boolean remove(Object object)public boolean removeAll(Collection<?> collection)public boolean contains(Object object)public boolean containsAll(Collection<?> collection)public boolean retainAll(Collection<?> c)Shouldn't the signatures ...

How to stop/destroy a thread safely?

194 byte By jiangshachinaa at 2007-11-27 6:24:17
Currently, method Thread.stop, Thread.destroy are deprecated.How can I stop/destroy a thread safely?Or a thread is needed to be stopped when it finish its job?Thanks!

MIME type from InputStream

241 byte By amitdalvia at 2007-11-27 6:24:32
From an InputStream coming out of a file can we find out the MIME type of that file? I can't rely on file extension etc. Let me know if someone has tackled this issue or has any insights. Thanks in advance

Singleton annotation

566 byte By developer_jbsa at 2007-11-27 6:25:11
anyone want to share the implementation/resolution of an annotated singleton, e.g.@Singleton // ?public class Foo { @Singleton // ? private Bar bar; @Singleton // ? public Foo() ...

Proxy annotation

625 byte By developer_jbsa at 2007-11-27 6:25:14
anyone want to share the implementation/resolution of an annotated copy-on-write proxy, e.g.@CopyOnWrite // ?public class Proxy { @CopyOnWrite // ? private byte[] bigBuf; @CopyOnWrite // ? public Proxy() ...

Difference Between connectity methods

141 byte By sridanua at 2007-11-27 6:25:36
Hi im a bit confused,can som one pls explain the difference between Serial, Socket and Telnet connections.tnx in advance

How to sort List elements.

251 byte By Dilip_biswala at 2007-11-27 6:25:38
Hi Friends , Can anybody tell me how to sort List elements ? I mean to say that suppose a List object have three state i.e. Fname, Emp-id,Lname , so how can i sort this List object against their Emp-id.Pls , help me out in this regards.

How strick is type checking with Typed collections ... ?

1999 byte By duvelbiera at 2007-11-27 6:26:17
My problem can be summarized like this :We have a interface definedpublic interface DataStructure{ // ... getters only}Then, an implemetation of the interfacepublic class DataStructureTo implements DataStructure{ // implemetation of the getters only}We then defined the Editable versions of the ...

how an array become dynamic

90 byte By nanda.pa at 2007-11-27 6:26:19
How to make an array as dynamic growing array in java?instead of using collections.

how to get domain name server's IP

130 byte By seablue1023a at 2007-11-27 6:26:36
can somebody tell me how can i get the DNS' IP? is there a method that can get the ip of the dns?thanks in advance!

Weird MARSHAL Unable to read value from underlying bridge problem

42721 byte By DonStevoa at 2007-11-27 6:26:54
Hi there,I have a very weird problem with the mentioned exception.I try to call a remote EJB to get details from a certain object (just get the EJB and related information, put the data in transfer objects and transport it to the struts action with facades and services).Weirdest is this:The ...

Values from a properties field to an ArrayList

271 byte By Arch_Bytesa at 2007-11-27 6:27:02
I have a properties file that contains IPAddresses.. I use it to record searches and hits made by those who access my page.. The thing is I need to pass the values to an ArrayList to make my life easier..Any suggestions as to how?Thanks in advance..!

Reconnect pool with oracle

827 byte By lghm@aeiou.pta at 2007-11-27 6:27:07
HiI'm having some problems with my connection pool because in my network, after some time of inactivity, I lose the connections between the tomcat and the database.What I need is a way to restart the pool if lose the connection to the database.Anyone know something to do this?My pool is ...

problem with HashSet - autosorting...?

1681 byte By Holoda at 2007-11-27 6:27:23
I have such problem: private HashSet connectionName;.........public String getConnectionName(int i){Object[] strArray = new String[connectionName.size()];strArray = connectionName.toArray();return strArray[i].toString(); //I keep there String values}The problem is: the input element order ...

Jconsole throws java.lang.OutOfMemoryError: Java heap space

449 byte By Antsa at 2007-11-27 6:28:41
Hi Guys, I need a great help from all of you. i am using jconsole to monitor my java application memory.After some 5 days of continuous monitoring through jconsole, i got a "java.lang.OutOfMemoryError: Java heap space" in command line and no progress after that(because of out of memory error). ...

RandomAccessFile eficiency

286 byte By cristiba at 2007-11-27 6:28:49
Hi all,I need to open a RandomAccessFile() for reading and writing and saw the docs for the constructor RandomAccessFile(File file, String mode).Was just wondering if there is any performance gain if I use "rwd" for mode, instead of "rw".Thanks,Cristi

which one is the best among collections

86 byte By nanda.pa at 2007-11-27 6:29:05
May i know which one and why it's the best among the other collection classes?

indexSublist() in Collections class uses Brute Force (!)

517 byte By diku.hma at 2007-11-27 6:30:37
Does anybody know if there is a particular reason for why the indexSublist\indexLastSublist methods in the Collections class use the brute force algorithm instead of a more sophisticated matching algorithm, like Knuth-Morris-Pratt for instance?Would that be overkill, perhaps?Knuth-Morris-Pratt ...

Issue with Subtyping and Autoboxing

1874 byte By Thomas.Mathewa at 2007-11-27 6:30:45
Hi, I have a problem with subtyping and autoboxing. Can anybody please help me to know the reason for this.public class GenericSubType<T extends Integer> {T iVal;public GenericSubType(T t){iVal = t;}public static void main(String args[]) {GenericSubType<Integer> gst = new ...

Java Mail

1813 byte By burntcandlea at 2007-11-27 6:31:22
First of all, am I in the correct forum. The code is below, it may be way off the mark, but I think it's another problem:at the bottom of the code, I put my e-mail address in the Address object. But the exception I get is:Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: ...

httpurlconnection chunked output stream?

753 byte By otismollya at 2007-11-27 6:31:58
Hi,I'm developing a client that interacts with a comet server (comet allows http connections to be used for multiple inputs and outputs on same connection -- not single request, single response). I've found that I can't use HttpURLConnection because it doesn't allow writing to its output ...

ObjectOutputStream.writeObject(Object obj)

230 byte By VineetGarg2007a at 2007-11-27 6:33:32
Why is the obj of Type Object and not Serializable. According to my understanding the obj should have implemented serializable or inherited it from its object hiererchy. Then why is this restriction not imposed at run time?