Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Jax Laakso

Greenhorn
+ Follow
since Dec 07, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jax Laakso

But it looks like that only works for a set period of time. So if I started the program up at 8am, it would always run at 8am and not at 5:15am. And if I set the timer up to run at 5:15am I would have to restart it from 8am. So if it would crash at 2pm, I couldn't restart it until 8 the next morning, right?
Jax
16 years ago
All right. I have System.currentTimeMillis() running but how do I get my program to understand all those milliseconds are 5:15am? Can I use a dateformat to format the milliseconds into something readable? Is there another way to do this?
I don't want it to run just 24 hours after it starts, because if the server should go down, I don't want to have to come in at 5:15am to start it up again. Which from my understanding is how the Timer class would work. It would simply go to sleep for a set amount of time and then wake up and run.
I want to be able to start it when I come in at 8am and trust that it will run at 5:15am.
Thank you for your help,
Jax
[ March 04, 2002: Message edited by: Jax Laakso ]
16 years ago
Actually I'm trying to get the current time. My program needs a timer so that it can run everyday at 5:15am. But the Calendar class can't be instatiated becuase it's abstract and most of the Date class has be depreciated. So I'm wondering how to do this. Am I going to have to use a Timer? And if yes, could someone explain how those work? I tried the Java API, but that just confused me.
Jax
16 years ago
I'm a bit confused and hoping someone can help me. I need my program to grab the current time from the OS and then compare that to the time I gave it. The problem I'm having is that it's only grabbing the time once. For example, if I start the program at 1410 then the time will ALWAYS be 1410 and not 1530 or whatever time it is. How do I get Java to continually get a NEW time when it's needed?
Thanks a bunches, I'd rather not have to rewrite this with a timer function, since I don't understand those.
Jax
PS--This worked fine on the Macintosh I orginally wrote it on.
16 years ago
I'm having problems porting my java aps from the Macintosh I programmed them on over to a Windows machine. I'm using CodeWarrior on the Mac and I don't know which files need to be moved over to the Window machine that the program will eventually run on.
Yes, I know I could simplify things by simply programming it on the machine it's going to run on, but I need to run it on the server and working in the server room is cold and I'm not sure the company would like me very much if I spent hours and hours in there. Any help would be greatly appreciated.
Jax
16 years ago
I'm having problems getting the JDBC Type 4 driver to work. We installed it on the server, however, I still get an error:

JDBC driver could not be found and loaded!


Do I need to install the driver on my machine? And if I do, how do I change the classpath on a Macintosh? I'm using CodeWarrior Pro 5 but can't for the life of me figure out how to set a classpath on the Mac.
Thank you for the help in advance,
Jax
Ok! That's so much clearer now. Thank you.
Jax
16 years ago
All right, but I'm confused as to how just reading from the socket, without specifying which exact file I want to read from, is going to give me the information that I need.
The file is called e_warehouse, and it's on a server. the program I'm writing is on the client. I need to grab e_warehouse from the server, pull the tracking number and the inventory numbers and then print those numbers to the database. I can do everything except getting the file right now.
Jax
16 years ago
Would it be possible to get an example? When I try to wrap it around the getInputStream() it tells me that it can't convert a stream to a FileDescriptor. and it won't allow me to do it the other way around. Meaning getInputStream(FileReader())
Jax
16 years ago
Well I figured out the port, but I have NO idea how to get at the files. How do I use a fileReader with a socket? Can I even do that and if I can't, how to I access the file?
I've been looking at Sun's API but they're not very helpful. Neither is there tutorial. Any help here would be hot.
Jax
16 years ago
Can anyone give me an example of how to read a file from a server? I think I need to use sockets but I don't know how to find the port.
Basically, the program I'm writing takes a group of files from the server, runs them through the program, pulls information from the file, and then adds it to a database. I'm having problems getting the file from the server.
Any help would be great1
Jax
16 years ago
You will get that error if you're using the charAt() method and other methods. According to java.sun.com's API documentation you get that error when:


public class StringIndexOutOfBoundsException
extends IndexOutOfBoundsException
Thrown by the charAt method in class String and by other String methods to indicate that an index is either negative or greater than or equal to the size of the string.


For example:

The above code will generate the StringIndexOutOfBounds exception because there isn't 100 characters in string test.
Jax
16 years ago
I believe if you just move over the .jar files you'll be ok. The last app that I wrote only needed those to move with the app, however, I'm running off a mac and the program went to another mac, so I don't know if Windows is different. I can't imagine it would be, otherwise Java wouldn't truly be cross-platform would it?
Jax
16 years ago
Have you tried using a String Array?
example:

That way you can access them as you would an array, using the address of the line (allTheLines[100]) to access the line you're looking for.
Jax
16 years ago
I'm using the JFileChooser to open a tab delimited file. Only I need to run through the entire file in my main program which doesn't have any interface with the user at all. The file is read in, and two files are spit out containing the correct information based on the tdl file.
My question is this. Am I going to have to write the entire program in the Swing class or can I write this in the main program and how do I get it to run one line at a time?
Thank you,
Jax
16 years ago