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 ...
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, ...
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 <?> ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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.
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 ...
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...
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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: ...
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 ...
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 ...
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(), ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ?
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 ...
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 ...
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, ...
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. ...
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. ...
When sholud i go for abstract class and when sholud i go for interace and which one will prefer when we are doing project...?
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 ...
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 ...
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 ...
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( ...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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(); ...