Scott Appleton

Ranch Hand
+ Follow
since May 07, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Scott Appleton

This feels like a dumb question, but browsing the API hasn't produced an answer for me yet.
I want to get an integer value for the number of days elapsed since a given date. I can create a new Date() object for today, but I can't find a method that will perform a date-date subtraction cleanly. I could use the DAY_OF_YEAR field, but that gets dirty once you start comparing dates from different years. There must be a cleaner way to do this.
21 years ago
You can also use the Calendar class, since a number of the Date methods have been deprecated:

22 years ago
I forgot to mention that the target of the exec is itself a java application. The main agent is being run in Lotus Notes. However, the current version of Notes (R5) uses the 1.1.8 compiler, and the requirements for this agent require that data be transmitted to an HTTPS server. JSSE supports SSL security, but is not compatible with the 1.1.8 compiler; therefore, I'm having to use a workaround wherein the data transmission is handled via an application compiled with the workstation's JDK 1.3, which must then be called from within the Notes Java agent via the Runtime.exec() method.
I'm not sure if that background is important in resolving the problem, but on the chance that it is...
22 years ago
I'm calling an executable within a Java agent thusly:

The problem is that the main program will block on the waitFor() method. I'd like to run the Process in a separate Thread and then run a timer on the main thread and interrupt the Process if the timer expires before the Process terminates.
Since Process neither extends Thread nor implements Runnable, I cannot attach it directly to a separate Thread. And since it is Abstract, I'm unable to instantiate a subclass that could otherwise be attached to a Thread.
Does anyone have a suggestion to help me trap for a hung Process and terminate it so that the main agent does not also hang?
Thanks for your help.
22 years ago
I have installed JSSE (following the instructions as carefully as I could, since network security is somewhat Greek to me) and included Carl's code in my class. The second line (Security.addProvider()) generates the following error:
NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
The jar files are installed in <home>/lib/security, which is in my Classpath. The file has been updated as the instructions direct. I don't know what else to do to make my program "see" the JSSE jar files. Any suggestions?
Thanks for the clarification, Cindy.
Upon exploring your link I discovered that indeed, my JLS is outdated. I downloaded and printed the pdf all of 2 months ago, but it has since been updated with a new version. Unfortunately, they have altered the references significantly enough that my 850-page document is virtually useless for posting references here. I guess I'm going to have to download the new version and spend another half-day monopolizing the network printer
22 years ago
Is my JLS outdated? None of the references given match my 2-volume tome.
My JLS 8.5 is Static Initializers and says nothing like the quote given. The same is true for the other quotes.
22 years ago
Thanks, Cindy. I'm going to explore this link and see what can be done.
I have a partial answer to the original problem -- the IDE I'm using (which I HAVE to use, ugh) implements JDK 1.1.8. Turns out that setProperty(String, String) is new to the System class in 1.2, so the compiler used by the IDE doesn't recognize it.
That doesn't explain the "security properties not found. using defaults" message when I compile using my own version of the JDK (v1.3).
22 years ago
Cindy, maybe this is a new property. The JSSE Extension installation indicates that in order to use the https protocol, you must set the "java.protocol.handler.pkgs" system property, either at the command line (which is not possible in the implementation I'm having to use) or via a call to System.setProperty().
I'm also getting a "security properties not found. using defaults" message when I compile. My file is located in a standard location (<java-home>\lib\security)
[This message has been edited by Scott Appleton (edited July 24, 2001).]
22 years ago
The following line of code:

System.setProperty ("java.protocol.handler.pkgs", "");
generates the following error:
"Method setProperty(java.lang.String, java.lang.String) not found in class java.lang.System"
How could this error ever be generated, since of course there is such a method in
22 years ago
Peter, I will repeat myself: Anything can be abused. The potential for abuse should not in and of itself justify prohibiting an activity altogether. There are equally sad stories concerning smokers, casual drinkers, consumers of both prescription and non-prescription drugs, etc, but those things are not banned simply because the potential for abuse exists.
22 years ago
I'd have to say that the 2 hours is very generous. I answered all the questions in just a tad over an hour, then spent 5 minutes or so reviewing marked questions, and that was it.
22 years ago
Way to go, Jeena. If you found the exam easy, then you've got this Java thing down pat
22 years ago
I'm not seeing where it will print anything unless you click the button.
Assuming you do, the click event is sent to all the registered listeners, and in no guaranteed order, so it's true that you can't be sure which listener will have its actionPerformed method executed first.
I'd agree with Arsin, though I'm also partial to the city about 90 minutes up the road.
22 years ago