Paul Clapham

+ Follow
since Oct 14, 2005
Paul likes ...
Eclipse IDE Firefox Browser MySQL Database
Vancouver, Canada
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Clapham

You're getting messages which say "An exception occurred". It would be helpful to know more about that exception. So could you look through the logs and see if you can find a stack trace for it?
4 days ago

Tim Holloway wrote:but you can also spawn an engine thread(s) in your webapp ServletContextListener startup listener.

I'm no longer writing web apps, but I have been curious about this for quite a while. Is it okay to just use an ordinary ExecutorService, or when you say "engine thread" does that mean something more limited?
4 days ago

Tim Holloway wrote:NONE of the issues I see relate to the Raspberry Pi. They're all related to Java and to the dependence on an IDE.

This is absolutely true. Somebody added the thread to the Netbeans forum but yes, it's just another question about how to set the classpath.
4 days ago
Okay, you're ahead of me in working with Swing look and feels. Good to hear you have the solution now.
4 days ago
If the class isn't in a package then you just need to put the class name in that command. Like so:

java -classpath /home/pi/Desktop/Jars/* GUI

Don't forget the wild-card symbol to tell Java that the classpath includes all jars in that folder.
4 days ago
Hi vincenzo, welcome to the Ranch!

To me it looks like you're setting the JComboBox's border at line 32 of your code. You say you don't want that border? Then it seems to me you could just remove that line of code.

You also have a method called createArrowButton which does a lot of things with your special border-maker, but I don't see any code which calls that method. Anyway I don't understand why you don't put the special border around the combo box, instead of making a separate button.
4 days ago

andrew mcnamara wrote:What is a simple way to run our jar on the Pi through terminal while including multiple 3rd-party library jars in the class path?

java -classpath /jarpath/* YourMainClass

Put all of your jars into the /jarpath folder. "YourMainClass" is the name of the class with the main() method which you want to run. Don't forget to put the package name before it.
4 days ago

Norm Radder wrote:If the files are all in the jar file, accessing the contents of the jar file with getResource should work the same on any OS.

Yes, it should. But that's assuming that the resource in question is really being found in the jar on the Windows machine, which appears to work correctly. The code which was posted just looks in the classpath, so perhaps it's accidentally finding it somewhere else on Windows.

I also didn't think you got a FileNotFoundException when the getResource() method didn't find the resource, but I could be wrong about that. I haven't written a little test program to see whether that's the case or not.
5 days ago

Sam Ritter wrote:Obviously...

On the other hand, I notice that you are using a relative path. So the hypothesis that your working directory isn't what you think it is, that's also a possibility. A fairly strong one, too, given that Unix does use the / as the path separator.
5 days ago
Well, yes. Your server code tries to create a SocketServer, but as the error message says, the address is already in use. So perhaps you already created another SocketServer earlier and didn't shut it down properly. The following log message says that the new thread is running, which suggests to me that your code ignores the error message and starts a new thread which isn't listening on any port.

As for the client, it tries to connect to the server, but the server doesn't respond. Probably because the server code isn't working properly, which we already know that.
Have some variables to store the totals. Set them to zero initially. Every time you get the numbers for the columns, add them to those total variables.
1 week ago
Hi Thiago, welcome to the Ranch!

Thiago Medeiros wrote:...because obj is of type Object...

You don't know that. Not exactly, anyway. All you know is that obj refers to some object which can be cast to type Object. So yes, it's fair to say that it's of type Object but it could be of any other type also. It could be of type Book, for example.

So, why is it returning false, instead of throwing a ClassCastException?

Because that's what the "instanceof" operator does. The designers of Java rightly decided that there was a need for finding out whether an object could be cast to a certain type. The example you posted is an example where that need exists. But having the operator return "true" if it could be, and throwing an exception if it couldn't be, that wouldn't be a good design. Don't you agree?

andrew mcnamara wrote:Precisely the same error results when I run with the jars in the WITPhoneHome folder.

Well, as I said earlier, "java -jar yadayada.jar" isn't going to include any other jars in its classpath. Were you still using that version of the "java" command?

And jars inside a jar, which it sounds like you tried, aren't part of the classpath even if the containing jar is.

I don't know much about Netbeans but if you could get it to include a Class-Path header in the runnable jar it's generating, that would solve your problem. I don't know what that would look like in the component which generates the runnable jar but looking around at some of its options which you aren't using yet might help.
1 week ago

Campbell Ritchie wrote:You mean you have learnt how to recognise bad tutorials on the Net?

The odds are in your favour when you recognize bad tutorials. Recall Sturgeon's law, which is usually summarized as "90 percent of everything is crap". But cynicism aside, yes, it is a useful skill.
1 week ago