Java-index »» Core »

How to convert a string to date and then compare it with todays date?

755 byte By me_elf at 2007-9-26 1:13:37
Hello.I want to set a format first for my datesDateFormate df = new SimpleDateFormate("yyyy-mm-dd");once this is done then I want to convert any string to date object in the above formateString str="2001-07-19";Date d = null;try{d = df.parse(s);}catch(ParseException pe) ...

NullPointerException on hasMore()

532 byte By giamma13 at 2007-9-26 1:13:39
I am calling hasMore() twice in a row, when the enumeration is atthe end.So the first will return false but the second one will throwthis exception:java.lang.NullPointerExceptionat com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:113)at ...

RMI totally broken on Websphere & AS/400

735 byte By 69speed69 at 2007-9-26 1:14:10
I am trying to bind an object to a port usingWebsphere on the IBM AS/400 and it totallydoes not work. I developed on Win2K andit works fine, an exception### -> Error initializing RMI interface.Exception Server RemoteException; nested exception is: java.rmi.UnmarshalException: error ...

Need Help to figure out date behavior

538 byte By khalidali63 at 2007-9-26 1:14:15
Here is my codeString currentdate = new String();Calendar calender = Calendar.getInstance();currentdate = calender.get(Calendar.YEAR) + "-" +calender.get (Calendar.MONTH) + "-" +calender.get(Calendar.DAY_OF_MONTH) ;My question is I have tested this code on 3 different windows machines,but for ...

algorithm for subtracting dates..urgent please

330 byte By kollareddy at 2007-9-26 1:15:12
HiI need to write a java program (without using any java predefined libraries or functions) that subtracts two given dates and outputs the resultant number of days. Please let me know at the earliest if there is any predefined algorithm to solve this.Your help is highly appreciated. Thanks in ...

Applet to Servlet Communication

1706 byte By ashok-hv at 2007-9-26 1:15:16
Hello All,I have written an applet which uses URLConnection object to invoke and post some data to the servlet. Basically a Post operation. I am using following piece of code: URL url = new URL(" http://localhost:8080/servlet/SimpleForm");String qry = URLEncoder.encode("name") + "=" + ...

JNDI authentication

537 byte By bacchia at 2007-9-26 1:16:02
the problem is:when a client create a connection whit my server j2ee using the properties env.put(Context.SECURITY_AUTHENTICATION, "simple");env.put(Context.SECURITY_PRINCIPAL, "pippo");env.put(Context.SECURITY_CREDENTIALS, "secret");all is ok,but when the client not use this properties it ...

Report write tool...

124 byte By gunj011 at 2007-9-26 1:16:47
Which report write tool would you recommend ? The generated code should work on Unix, NT, AIX, Solaris, OS/400

Problem with Javax.Naming

248 byte By abhinay_rai at 2007-9-26 1:16:52
Hi everybodyI have downloaded j2sdkee1.3 for compiling ejb files but there is error when i compile my client file which uses javax.naming package.The compiler is not able to locate the pkg.Can somebody help me pls.Thanks

how to convert a class file to exe file and how to cteate a class file to d

61 byte By bhaskarg at 2007-9-26 1:16:55
how to convert a class file to exe file

my question is i f i press a button on a system (ip addrss is like 192.168.

311 byte By tadaka_ravi at 2007-9-26 1:17:00
my question is i f i press a button on a system (ip addrss is like 192.168.122.9 ) and i want to open a html form on another system (ip address is like 202.9.121.2) this is my question please try to send answer if u know thank you my dear friend bye Ravi chandra ...

Reverse a TreeMap

114 byte By EricMacau at 2007-9-26 1:17:03
Hi, Would you please to teach me how I can reverse a TreeMap ?Best regards,Eric

INI is hectic

231 byte By siv-viv at 2007-9-26 1:17:06
well what im trying is that a java application should read a INI file(initialization file) while it starts , how can i specify a java program to read a INI file when it starts.any help is welcome with utmost gratitude

I was present at .Net Visual Studio beta 2 seminar.

640 byte By WHOSNEXT at 2007-9-26 1:17:12
Over 7000 developers were attended!!I've been very surprised at the marketing of MS. They gave me a lot of books, CDs, and so on. Great commercial skill. Sun can never do this!!I think .Net platform is not better than Java's. But now, the most of client environment is Windows. Who would use ...

Collection Of Collections

610 byte By lingamaneni at 2007-9-26 1:17:24
Hi all,I am dealing with a search page which is having 8 search fields. i have a way for individual search fields. but i need to have multiple search.. with any to any combination in all the 8 fields. for this I need a List or an ArrayList which can hold Lists aagain. Eg:List a = null;List b = ...

Performance Question

704 byte By mafa at 2007-9-26 1:17:37
I have a singleton that is accessed by 10000+ clients.The singleton has a Map that holds some objects. At initialization time the Map won't hold any objects. The Map will increase over time to about 1000 object.Which solutions gives the best performance?1. The Map is a Hashtable.2. The Map is ...

How to load packages and run a class in it through network

120 byte By zby at 2007-9-26 1:18:02
Now I can load a class through network, but can't newInstance it, because it need packages. How to do it?

Redirect System.err for a single thread

736 byte By jburggraf at 2007-9-26 1:18:04
Is it possible to redirect System.err for a single thread?I have a servlet that kicks off javac. I save the System.err PrintStream and I redirect System.err to an output file during the compile. After the compile is complete, I redirect System.err back to it's original destination and read the ...

NullPointerException at com.sun.jndi.ldap.Connection.run(Connection.java:52

643 byte By sjoffe at 2007-9-26 1:18:17
We are using the Sun jndi 1.2.1 files from a Java client toaccess the IBM SecureWay Directory 3.2 server. Our test case isretrieving entries using the ctx.getAttributes (String, String[])method. Occasionally we are receiving the following error.java.lang.NullPointerExceptionat ...

Can some one please take a look, adn let me know what I am doing wrong?

1705 byte By me_elf at 2007-9-26 1:18:46
please take a look at the complete code in question...public class DateStamp { public DateStamp() { } public static void main(String[] args) {DateStamp ds = new DateStamp();String s ="2001-07-20".trim();ds.setThisDate(s); } public void setThisDate(String s) {s = s.trim();DateFormat df =new ...

sockets or rMI?

416 byte By sseans at 2007-9-26 1:19:13
I am makign a cards game (bridge). Do I use pure sockets to communicate clients and server or RMI?The game would require lots of message passing and different parameters and braodcasting(each move to be displayed to all players and also only mouse events of that player to be activated whose ...

Using Sockets and XML

690 byte By wakthar at 2007-9-26 1:19:19
Hi,I have a problem of interleaving XML messages in a socket.The problem revolves around sending a client command being issued through sockets to a server program which then bundles the answer back as an XML data stream back through sockets.Now if a user issues one command say X and then ...

connecting over LAN problems

1088 byte By r_stich at 2007-9-26 1:19:37
Hi, I'm trying to get a sample program going over a small desktop - laptop lan (both running windows 98se and named "desktop" and "laptop" on the network). The program works fine when both server and client are on the same computer, but when I copy the client files to my laptop and run from ...

Database Program (drivers & Stuff)

884 byte By Kngus at 2007-9-26 1:19:39
Hey Everyone, I'm a 3rd yr student in Computer Science, and I'm doing a little project for my co-op work term. I've worked out that for the program I want to create, to work, It would be the best idea to implement the use of a database, where I would store a lot of information. The basic ...

Saving 2D Drawings.

168 byte By niy8 at 2007-9-26 1:19:40
Hi,How can I save 2D drawings to database?Do anyone of you who know where can I find more information on this area ?Thank you.

Interfaces and reflection

194 byte By raduh at 2007-9-26 1:20:01
How can I use reflection to verify if a (instance of a)class implements a certain interface? Suppose that the interface is java.rmi.Remote, so it has no fields, no methods. Thanks.

garbage collector - controlling it

1071 byte By ddurnell1 at 2007-9-26 1:20:21
The main performance problem on our website right now is from the garbage collector. Yes, our site is very 'thick', but the gc locks out other threads for 10 seconds or so regularly, and once a day or locks it up for several MINUTES. The main problem is that we have a few very large objects ...

Multiple proxies handling

674 byte By tbtong at 2007-9-26 1:20:42
Hi,I have an application with multiple threads that run simultaneously. Each thread has its own HttpURLConnection object. This object will send a http request to a webserver. I would like to be able to specify the proxy that this particular request will go thru before arriving to the origin ...

Simple listing of Active Directory

1383 byte By adunnxxx at 2007-9-26 1:20:48
Using attached code to hit Win2K active directory server. Hit server OK (no errors/exceptions), but the returned enum never has anything in it. Using EXACT SAME code against a public LDAP server works like a champ. Wrote ASP (ugh!) page using ADSI with exact same parameters as below and get ...

Finding source files programatically

487 byte By sgoldstein1 at 2007-9-26 1:21:05
Suppose I have a class com.foo.Test. In that class, I want to add a method, File[] getSourceFiles() which will find the directory in which Test.class resides and return the names of all the other class files in that directory.The problem I'm having, is that I can't get a reference to the ...

How to find out the public methods and public fields available

290 byte By meenum2002 at 2007-9-26 1:21:13
Hi,I have a dll for which to use it, i need to know the methods and the fields available for public use. Is there anyway to find out that information using any tool. I dont have any literature about the dll. Only have that dll. Thanks in advance,-Madhuri.

"switching of echoing characters" in System.in.read(), System.in.readLine()

210 byte By ganga4 at 2007-9-26 1:21:25
Hi,I am trying to create an effect in System.in.read() or System.in.readLine() by not echoing the characters, if anyone knows please let me know,thanx!!!!

Running Java from VC++

71 byte By shahidah at 2007-9-26 1:21:41
Does anyone know how to run java program from Visual C++?

How do you communicate between flash and java?

269 byte By chihuahua at 2007-9-26 1:21:46
Hi,How can you pass parameters between a Flash movie and a Java applet running on the same machine? I would like to do this without opening a new browser window or putting parameters in the url of the browser window that is running the Flash movie.

Running a java applet from flash

228 byte By chihuahua at 2007-9-26 1:21:47
Hi,How do you run a java applet from within a Flash movie?Is it necessary for the user to download a java interpreter, or is there an interpreter somehow built into their browser that can run applets?

socket constructor with IP adress?

274 byte By sseans at 2007-9-26 1:22:07
is thre a constructor for a socket that uses IP address . My serevr is runnig on my machine on IP address 127.0.0.1. How can I connect a client on this using the socket constructor?ie socket in = new Socket(-? , 8189);

sun.net.ftp package

873 byte By shrinivashan at 2007-9-26 1:22:30
Hello !I have a requirement where I have to download files from a remote machine using ftp.As of now I am using the sun.net.ftp package and my application seems to work fine but I face a few problems:1) Reading file names alone from the remote machine seems to be a problem when using the ...

allocateNewObject instead of NewInstance?

1004 byte By mchahn at 2007-9-26 1:22:31
I am working on a Java development tool that requires instantiation of arbitrary classes using reflection. My tool needs to be able to instantiate an object of any class, just as deSerialization does. Any ideas on how to do this would be greatly appreciated.Reflection doesn't allow this ...

Please help !!!

130 byte By obraineagle at 2007-9-26 1:22:53
hello every body,How can I set a socket time out for a HttpURLConnection in JDK 1.4 ?thanks in advance

OOP Question

923 byte By rwfocke at 2007-9-26 1:23:05
Okay this isn't really a Java question, rather a OOP question.Say i'm creating a class heirarchy of Objects, which have both functionality (not related to how it looks) and can be displayed.For instance the game of chess. Each Chess piece has it's own movements etc. It also has a specific ...

client as an applet

175 byte By sseans at 2007-9-26 1:23:17
how can I run an applet as a client? I mean how can I run it from the dos prompt ?Do i have to put it in an html file ? how can I use appletviewer?

Byte stream send/receive problem...

1294 byte By athan00 at 2007-9-26 1:23:23
Hi all,I ve got the following client (applet) & server (application) and I am trying to tranfer some data between them, but strange things happen...!For example some times the packet comes double (e.g. "Athan;Athan;" instead of "Athan;") or other times comes half! (e.g. "Atha" instead of ...

datainpustream or bufferedreader?

268 byte By sseans at 2007-9-26 1:23:44
Iam trying to make a bridge game using sockets only.How do I pass messages from client to a serevr and vice versa using bufferedreader or datainputstream?extra:any ideas on whetehr I should be using sockets or rmi? which is easier please ?

invikeLater

203 byte By valjok at 2007-9-26 1:23:49
I have a lot of one-line operators that I want to execute in dispatch thread and it doubles amount of code to create Runnable object each time. Is there any machinery to optimize situation?

Problem invoking writeObject() on an object containing displayed data

1350 byte By Eric.Vautier at 2007-9-26 1:23:58
I get a nasty NotSerializableException error when attempting to call ObjectOutputStream's writeObject() method from a JFrame menu. It tells me ToolTipManager can't be serialized, yet the object in question contains no swing or awt reference. The same call from a non-GUI object works fine, ...

change desktop background?

201 byte By kevinpriebe at 2007-9-26 1:24:20
Is there any way to make a program (in any language) that, when run, will simply change the win98 desktop background to a file that i specify in the code? Thanks for any help!kevin

problem reading byte stream:(

1308 byte By mayra at 2007-9-26 1:24:30
Hi i am quite new in Java and i have this problem! i am trying to read a remote-sensed image and display it. to make things more clear:The image i am using is a remote sensed image 512 * 512 . It has three bands, green, red, nir.The data is 8-bit (single byte) and in a binary byte format. The ...

Swing + threads?

198 byte By sseans at 2007-9-26 1:24:40
is it true that componenets in swing need extra care and modifications if the event handler does not modify the components ? (eg a thread should also be able to modify the componenets?

Lesson 8: RMI, Error in Run the RemoteServer Server Object

1980 byte By rodelb at 2007-9-26 1:24:42
Hello guys,Please Help!I try to test and run the samples in JavaTM Programming Language Basics, Part 1Lesson 8: Remote Method Invocation http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava1/rmi.htmlI already compiled the samples, but when I testing to run the ...

Hardware Interfacing

201 byte By alkit at 2007-9-26 1:24:49
Help,I am developing an application i which i need to read data from various hardware equipments e.g. Webcam, Scanner etc. I have no idea how to do this. Please Help!! It is urgent