James Ridley

Greenhorn
+ Follow
since Apr 21, 2006
Merit badge: grant badges
For More
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 James Ridley

I had a question about problem 10 in the Self Test of the chapter 7 in SCJP 5 book. I got the answer wrong, however, looking at the solution, when you change Herbivore to extend Animal, the munch() method defined by Hungry now has the Sheep eating the Sheep. Just for my own clarification and to help me better grasp generics, how would you go about changing the code sample so that the sheep could eat grass?

I came up with a possible solution, but it required eliminating Herbivore extending Hungry and then having Sheep implement both interfaces seperately. Would there have been a better alternative approach?


[ May 05, 2006: Message edited by: James Ridley ]
JBoss can provide you with session replication and hot deployment. It also supports mass deployment across cluster nodes via its farm directory.

What it won't get you is load balancing. They suggest using apache and the AJP connector to handle that aspect. There is information on their web site explaining how to set that up.
17 years ago
As long as both of your jar files are listed as resource, you should be able to use code like the following to access images:



I believe this would be the preferred method for loading properties files, images, etc that are bundled within jar files as you can use either ClassLoader.getResource(String) or ClassLoader.getResourceAsStream(String) to find them.
17 years ago
I'm not exactly sure how you'd pull that off. What resides under /usr/config/myConfig? Is it just everything that would be in a traditional deploy directory or is it the conf directory and the server libraries, etc?

Is this something that JBoss's netboot functionality could accomodate for?
17 years ago
As long as your codebase is the url to the remote server rather than localhost you should have no problems. So if the tomcat instance was hosted on serverA, I would use http://serverA:8080/mypirate/mypirate.jnlp to invoke it. The codebase path then should be http://serverA:8080/mypirate/.
17 years ago
Can you elaborate on what you mean? Do you have multiple directories under the server directory so something like:
-jboss
--server
----config1
----config2
----config3

If so would it be as simple as changing the URLDeploymentScanner mbean definition in conf/jboss-service.xml and change the url attribute to look at a specific path rather than the standard deploy directory?
[ April 27, 2006: Message edited by: James Ridley ]
17 years ago
I downloaded the sample you were using from java.net, http://today.java.net/pub/a/today/2005/08/11/webstart.html and got it to work locally on tomcat 5.5. Under webapps I placed a directory called mypirate. In that directory I have the mypirate.jnlp, mypirate.jar, icon.png, and splash.png files from the download. My jnlp looks like this and ran without error when I access it via a web browser at http://localhost:8080/mypirate/mypirate.jnlp.

HTH,
James
17 years ago
Can you use a third party graphing software? JFreeChart is an open source charting library that supports multiple types of charts and is fairly easy to use.
17 years ago

Originally posted by dhana sekar:

Exception Tab : frm java web start

</jnlp> ]
at com.sun.javaws.LaunchDownload.getMainClassName(Unknown Source)
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


I've only ever ran into that scenario in the following two instances,not to say there aren't more I haven't seen yet .
1) I didn't have the jar with the main class to run listed as the first <jar> element in the resources section.
2) The jar file didn't contain the class to run.

Can you verify both of these items are in place?
17 years ago

Originally posted by dhana sekar:

MissingFieldException[ The following required field is missing from the launch file: <jnlp>]


It would seem your xml format is incorrect. Your jnlp should match what was posted in the tutorial:
17 years ago

Originally posted by Barry Brashear:
Would swing applications have classes called "controllers"? I've heard
that swing version of mvc is more a model delegate.

Thanks.



You could consider the core JFC componets of Swing as delegates as they are both the controller and the view. Take a JTextField as an example. It is used to display the information from the Document it is bound to, but also updates the document as the user enters data into the field.

HTH,
James
17 years ago

Originally posted by Arno Reper:
How do you mean a package friendly interface?
package com.whatever.test;
interface MyInterface{}
is ok...
do you mean only useable in the package's class?
arno


Yeah, sorry should have clarified that. I was just trying to ensure I understood access levels on an interface. All the methods will be public by default, but the interface itself can have default package level access as opposed always being public.
Thank you very much for pointing me to that information. It cleared up my confusion.

Originally posted by Arno Reper:

an interface is always public abstract( you don't have to write it, its redundant )



Is that necessarily true? Can't you have a package friendly interface?

If I write something like:



Couldn't be used outside the package com.nowhere.test but would be a valid interface definition.
This question deals with question 1 for chapter 6 in the scjp for java 5 study guide.

If I have the following code:

Why is the output

I understand that the looping is taking place based upon the end result of the find method and it appears that it would iterate through every piece of String "ab34ef", so I would expect to loop once for every item in the string to see if it was a match to the pattern. My question is this, why do I loop 7 times if I've only got 6 characters in the string I'm using the Matcher instance against. I would have assumed 6.

Any light or clarification that could be shed on this would be appreciated. It could be maybe I just have the wrong view of how that code executes.