Generic (parametrized) enums

701 byte By AdrianSosialuka at 2007-11-27 4:53:00
Hi,I have just read generics FAQ by Angelika Langer and I am wonderingwhy it is not allowed to have generic enums. I understand, that the onlyproblem is it doesn't make any sense to use a generic type in a static context(at least in "normal" generic types). However, considering that it ...

java.io.NotSerializableException: java.util.Scanner

467 byte By Rafea at 2007-11-27 4:53:57
Hi guys,My program is a CD/DVD store. There are customers, admininstrators, each with login username and password. Now I have to save all data when exiting the program by either the admin or customer. Now i keep getting that exception whenever exiting. In the code Customer doesnt have scanner, ...

Type inference

2720 byte By AdrianSosialuka at 2007-11-27 4:54:18
Hi,We all know, that:List<Integer> li=new ArrayList<Integer>();List<?> l=li;l.add(1);won't compile. The main reason for that is that at runtime we loseall the type information, so compiler can't be sure, whether it cansafely add some object to a list. Because <?> ...

Input Stream Shutdown and different platforms

969 byte By sim085a at 2007-11-27 4:54:29
Hi,I am reading a book about sockets and in one particular section it talks about input shutdown. However it says that the input shutdown woerks differently on BSD platform, Winsock platform and Linux platform. For example it says that closing the input stream on a BSD platform would still ...

Killing a thread

309 byte By uberallesa at 2007-11-27 4:54:43
I have a small app running on Tomcat that handles a ServerSocket and threads ever single incoming socket. After a particular message is read by that socket I want to destroy it and release all of its resources. Since so much about threads seems to be deprecated....how can I do this? Thanks in ...

socket cross-talk.... multiplex read buffer?

662 byte By dew2hirooa at 2007-11-27 4:55:02
i am using only 1 socket:[pc #1] < socket > [pc #2]concurrently:the [pc #1] thread is sending input data to the [pc #2] thread.andthe [pc #2] thread is reading input data from the [pc #1] thread.this is of course, okthe [pc #2] thread is sending results data to the [pc #1] threadandthe ...

Java Bit-Level Programming

518 byte By Santosh.Bhushana at 2007-11-27 4:55:32
Hi,I am working on a file which has these chracteristics. File has many frames and each frame has certain no of bytes.a) One byte of a file is defined as frame_type (4 bits) Value = 0100berror_detection_type (2 bits)Value = 00bSOF (1 bit)Value = 1bEOF (1 bit)Value = 0bI can read bytes of a file ...

how to... join DatagramPacket and Serializable

593 byte By blelumpa at 2007-11-27 4:55:51
Hi!Here's what I want to achieve:I want to send a packet much more bigger than 256bytes. My serializable object has about 4000bytes. And I want send him to Client. How to do that? Everything is working while an object has not more than 256bytes. If it's more, there's exception ...

start rmi registry from java code

194 byte By dnavrea at 2007-11-27 4:55:59
how can i start the RMI registry using java code. ( without exec :D )during my application's work it may or may not need the registry so it'll be good if i can start and stop it.

Updated JNDI Tutorial

303 byte By jndi-deva at 2007-11-27 4:56:16
The new updated, shorter version of JNDI Tutorial is now available at: http://java.sun.com/docs/books/tutorial/jndi/index.htmlYou can read through the blog below to find out about the updates made to this ...

receive HDD ID using java

280 byte By firebunnya at 2007-11-27 4:57:52
Hi,Please kive me a hint on how to read the HDD ID using Java. I suppose, this topic should be discussed yet, but I did not found any references to a proper sollution. If any one has a source code for this, please kindly share it. Thanks and Regards,F.

Socket Program cant respond....

917 byte By Moorea at 2007-11-27 4:58:12
Hello guys,Could you please help me here. I am new to client/server programming and i want to learn more, here is my scenarion, I have a client, server and database front end programs. I pass SQL statements from the client to the server then the server invokes the statement through the database ...

reading a text file from a remote machine....

264 byte By iuytrra at 2007-11-27 4:58:54
hello guys...I need some help regarding this.I want a java file which should read the contents of a text file present in the remote machine, which can accesible through lan.... This is my requirement... waiting for your reply friends...

Please help in snmp project

29163 byte By sari_leea at 2007-11-27 4:58:59
the problem in this project is that it is not giving mib information of another computer, though it is retreiving info of local computer on which it is running. following is the sourcecode: main starts from snmpclint classimport javax.swing.*;import java.awt.*;import java.awt.event.*;import ...

class not serializable

510 byte By AngelGleza at 2007-11-27 4:59:00
Hi,I need to send with rmi an object not serializable (Algebraic fromo OpenMaple) and i can't do it serializable because its fields are not serializable and non accesibles.I have tried implementing the methods writeObject and readObject, but it doesn't work.I receive the exceptionerror ...

Getting NoClassDefFoundError, When executing Crystal Report

1122 byte By meetherevenkata at 2007-11-27 4:59:14
Hi Friends,I deployed all my crystal reports Stuff in Production Server(WebSphere Cluster Configuration), When i generate the crystal report its giving the below error[5/18/07 11:42:49:700 SGT] 0000005e SystemOutO [2007-05-18 11:42:49,699] com.crystaldecisions.reports.common.a3 if ? - Adding ...

Problem in calling a server behind a NAT router

800 byte By Lior_Levya at 2007-11-27 4:59:17
Hi All,I've been struggling with this problem for the past few days but I can't find any solution.I'm trying to establish a connection from a remote client to a server behind a NAT router. I put -Djava.rmi.server.hostname=XXX.18.5.236 in the server side, I'm calling the server with the ...

Looking for programmer

232 byte By Primjeta at 2007-11-27 4:59:25
HiI need to find a programmer available to program compatible Smart Card for use in Mutoh plotters: Rockhopper II and 3, Spitfire, Agfa Grand Sherpa,etc.Best regardsChristianbuy@primjetcolor.com.pl

Reading a file in the network

517 byte By Swapna_Ann_Jamesa at 2007-11-27 4:59:40
Hi,I need to access a file in the same LAN and read its contents. The machine name is something like Workstation22 and the file is located in D:\Parameters\SessionParameters.Can I access the file, if the file is not shared? I am completely new to Java Networking. I googled and got an idea about ...

how to communicate the integer value of char from C++ to Java

921 byte By BrigitAnanyaa at 2007-11-27 5:00:57
Well, I also used the Java Programming forum for this question,but since nobody answered, I am using another forum. What'sreally the right forum for this?I am calling a Java native executable from a C++ program.I would like to communicate the red, green, and blue values of an image, which are ...

ATM network's Jumping Windows and moving Windows algorithms

1196 byte By MyLovea at 2007-11-27 5:01:19
HI All,Any one can help by the source code and Algorithms about the given below topic.Simulation studies of the Jumping Windows and algorithms as useable for traffic policing and traffic Shaping within an ATM network. The algorithms should be simulated in software, using the MATLAB or any other ...

Explanation of two declaration please ...

442 byte By AdrianSosialuka at 2007-11-27 5:02:50
Hi,Could anybody tell me what the difference between the two is ?class MyClass<T extends MyClass>class MyClass<T extends MyClass><T>>What could I do with one of them that I couldn't do with the other oneand vice versa ...

why java.io.NotSerializableException ?

5384 byte By dnavrea at 2007-11-27 5:02:57
hi i have an application that should start an rmi registery and then put/get objects into it using JNDI.When i'm running it i'm getting the following exception:]javax.naming.CommunicationException [Root exception is java.rmi.MarshalException: error marshalling arguments; nested exception is: ...

A question of Set and wrappers

895 byte By lalotea at 2007-11-27 5:03:38
Hi, im asking why i can do this :private Set <Character>pila = new TreeSet<Character>();for(int i=0;i<palabra.length();i++) { -> palabra is a String pila.add(palabra.charAt(i)); // case 1 its OK pila.add(new Character(palabra.charAt(i))); // case 2 it's OK too}both ways the ...

Find out all usages of an annotation at runtime

888 byte By Irfya at 2007-11-27 5:03:39
Is there any way to find out all usages of an annotation at runtime? Hypothetically, something like Annotation.getDeclaringElements() which would return AnnotatedElements to which the specific annotation has been applied?JSR 269 is out of question, as I need this at runtime (correct me, if my ...

Socket and multithreading problem (flow control)

1197 byte By Zsefva at 2007-11-27 5:03:44
This code is heavily influenced by the KKMultiServerThread. I am having problems controlling the thread flow. login = new MultiServerThreadLogin(serverSocket.accept(), ...

How to split a file in two or more parts.

315 byte By Swing_guya at 2007-11-27 5:04:17
Hi, I am trying to write a program to split one large file into many small files. (like if file.txt is of 4MB I want to make four files file.txt.p1, file.txt.p2, file.txt.p3 and file.txt.p4 of 1MB each).Can someone please suggest a proper way of achieving this splitting task?Thanks in ...

"ClassCastException" for items in List after serialization

1771 byte By suppona at 2007-11-27 5:04:27
consider this code:public class MyClass implements Serializable { public double price = -1; public double volume = -1;}List list = new ArrayList<MyClass>();while(!endOfData) { MyClass mc = new MyClass(); ... mc.price = x; mc.volume = y; list.add(mc);}ObjectOutputStream oos = new ...

java.rmi.UnmarshalException: error unmarshalling return; nested exception

3926 byte By praveenreddy4ua at 2007-11-27 5:05:45
getting the following exception when i run my application java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.InvalidClassException: jisp.base.RateGroupInfo; Local class not compatible: stream classdesc serialVersionUID=-4194683926821053521 local class ...

Question about JXTA peers

364 byte By Krycek_Aa at 2007-11-27 5:06:00
Hi,I would like to know if it is possible to create a network of peers without a central server. That means that every peers acts as a server on his own and as a client at the same time. I would like to use JXTA sockets to accomplish this if that is possible.I use a rendezvous server though to ...

Why isn't there OrderedList/NavigatableList in the standard API?

546 byte By jdupreza at 2007-11-27 5:06:29
Hello,there are Ordered and Navigatable Set and Map implementations in the standard java.util APIs, but there is no equivalent for Lists.When you need to maintain an ordered list, you have to maintain it manually, using e.g. Collections.sort() and Collection.binarySearch().Is there any ...

thread.start() why called only once ?

221 byte By chiragpatel_05a at 2007-11-27 5:07:40
Why we cannot call start() method more than one time ? After completion of run method we can use the Thread object as a normal object but we cannot call start() method ? can anybody explain the reason behind this ?

Properties Collection: Error unable to bootstrap local properties

2295 byte By joshholla at 2007-11-27 5:08:28
I am getting an error printed to the console stating unable to bootstrarp local properties. The properties are loaded at application time as the static variable APP_SETTINGS the rest of the application uses the Fully qualified class name to get to the properties files. It sounds like it may not ...

ThreadLocal

775 byte By AdrianSosialuka at 2007-11-27 5:09:27
Hi everybody,I know how to use ThreadLocal class. I must admit that it is a nice tool :) I was surprised.Then I took a look at the code of the class and found out that it is somehow implementedusing map and thread's unique IDs as keys .... Am I right here ?The only thing I am not sure of is ...

Implementing C language TCP header using Java

1058 byte By k0balta at 2007-11-27 5:09:29
Hello,I am in need of implementing the following C language code under Java...{ short len; struct {char trans_id[4];char trans_filler[46];char data_vector[2];char data_len[2]; } tcp_hdr; len = 257; memcpy(&tcp_hdr.trans_id[0], "SURV", 4); memset(&tcp_hdr.trans_filler[0], NULL, ...

RMI Casting problems

3593 byte By batymohna at 2007-11-27 5:09:35
Hi all,I'm developing a chatroom with a built-in shorthand feature. The client, an applet, actually accesses 2 RMI serers: chat server and shorthand server. The chat server works fine, using LinkedList's. The shorthand server uses ArrayList (because I read that it was serializable and faster. ...

how to create an array with Generic type?

1449 byte By eli.aa at 2007-11-27 5:11:59
Hi,I need to create a typed array T[] from an object array Object[]. This is due to legacy code integration with older collections.The method signature is simple:public static <T> T[] toTypedArray(Object[] objects)I tried using multiple implementations and go over them in the debugger. ...

Regarding abstract and interface

132 byte By mega.chiranjeevia at 2007-11-27 5:12:43
When sholud i go for abstract class and when sholud i go for interace and which one will prefer when we are doing project...?

One thread waiting on multiple other threads

1060 byte By KeyzerSuzea at 2007-11-27 5:12:57
HiI am sure this question has been asked before, but google is not being my friendI have 3 functions incThreads_building, dec and wait.when it comes time to do the notify it gives me a Exception in thread "Thread-4" java.lang.IllegalMonitorStateExceptionI am a bit lost on thispublic void ...

Not understanding wait & notify

4255 byte By KeyzerSuzea at 2007-11-27 5:13:10
This test app keeps crashing and I am unsure whypublic class ThreadTest {public Integer counter;/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubThreadTest t = new ThreadTest();t.run();}public void run() {counter = new Integer(0);Thread ...

gracefully ending socket communication

3129 byte By superiorlobea at 2007-11-27 5:13:13
Hi. I have a client program and server program that communicate with a socket.Here is the important code from the server:ServerSocket server_socket = new ServerSocket(port);while (true){ Socket socket = server_socket.accept(); InputStream is = socket.getInputStream(); BufferedReader br = new ...

Appending new TextLine into existing file

747 byte By bullhunter74a at 2007-11-27 5:13:38
I tried to add new text lines into an existing txt file. The problem is my method add new Strings on the same line (to see it you need to open the output file with notepad).The method invoked is:public static void addText( String arg0, String path ) {long pos;try {raf = new RandomAccessFile( ...

advantages ofusing RMI for remoting

176 byte By Rama.Krishnaa at 2007-11-27 5:14:12
I would like to know the advantages of using RMI.As for my knowledge RMI is synchronous, and tightly coupled. Still it is used to register/lookup/invoke services.

Extending a annotaded class

1647 byte By rodrigo.bmtsa at 2007-11-27 5:14:44
hi,I'm facing the following problem: I have some objects extending an abstract class, and some of them has a kind of template classes, well, I'd like to know if I could put some annotations on these templates. I've tried, but didn't work.Is there some annotation to "say" to get the ...

How to display the same game board on seperate PC

594 byte By uttam_virusa at 2007-11-27 5:14:46
Rightnow I am working on the multiplayer java game project.The window application is done and working fine.Now I need to convert it to we application so that users can play from the different terminal.But I am facing problem to display the same game board with the same pieces on the different ...

Access resultset from database using collections.

309 byte By PaviEluri20a at 2007-11-27 5:15:53
Hi,I am retrieving data from DB(Oracle) and inserting it into a table and sort-on colum (subsort on multiple columns according to constraints). Can someone plz tell me whether using collections is a better way of doing it or a DB query? I don't want to access DB ...

Use of FutureTask

1089 byte By smiles78a at 2007-11-27 5:16:25
I have a class which implements Runnable and has a separate method for returning a result (few different methods because you can get various results) .. there is also some stuff that has to be done when cancelling/interrupting the running of this.Now, I've been asked to use FutureTask This is ...

EOFException through by ObjectInputStream.readObject()

6271 byte By Japhetha at 2007-11-27 5:17:32
I have a client-server application and I send messages between them by using a BufferedReader and PrintWriter to send the text and ObjectInputStream and ObjectOutputStream to send an enum type representing the type of message. Both the client and the server make threads that listen for incoming ...

Simultaneously request to servlet and causing duplicate trx_id

636 byte By newBabie81a at 2007-11-27 5:19:27
Hi,I have a servlet which will handle all the request from external.That servlet is responsible to insert the request into database by copy a record which already created in one of the table.My problem is when two requests are coming simultaneously with same trx id, I will hv error of duplicate ...

javax.servlet.ServletException: Name java:comp is not bound in this Context

2283 byte By patel123a at 2007-11-27 5:20:15
hii am trying to do database connection using JNDI lookup.The following is the code for that:Connection con;Statement st;Context ctx = new InitialContext();Context envCtx = (Context) ctx.lookup("java:comp/env"); DataSource ds = (DataSource)envCtx.lookup("jdbc/cust"); con = ds.getConnection(); ...