Angus Comber

Ranch Hand
+ Follow
since Jul 16, 2011
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Angus Comber

How does it matter if it is in web.xml or some other file. at the end of the day, to deploy it, the installer is going to have to enter some information. How does it matter what file it goes in. I don't really understand your logic there?

Jeanne Boyarsky wrote:Is there any reason you can't refactor your code to NOT have customer specific information in the web.xml? You could put it in a property file or an app server variable or an operating system variable.

If it absolutely must be in the web.xml, you could write a script to unjar the war file, update the web.xml and jar it back up. But this is awkward. And it would be easier to update the app to not have a web.xml dependency that is user dependent.

4 years ago
I understand that I can simply copy my folder structure into the preferred place under the web container directory structure. Even better would be to create a WAR file. But in my web.xml file is some customer configuration string which would be part of the installation / pre-install stage. Eg a user would be prompted for x and then the web.xml file would be updated.

How would I handle this? Is this the way:

1. prompt installer for string.
2. run command line function to update war file.
3. copy war file to web container correct folder.

Is a batch file typically used to do this? Anyone got links to any samples?
4 years ago

William Brogden wrote:Compiled classes get labeled with the Java version they are compiled for. Java 6 won't run a class compiled for 7 due to this label, not the features.


The trouble is customers are likely to have java jvm 1.4, 1.5, 1.6 and possibly 1.7. So for maximum compatibility and least deployment headaches I guess best to restrict yourself to only say 1.4 or 1.5 features?
5 years ago

William Brogden wrote:I would certainly try recompiling with the command line option -target 6

See the javac options.


I did try -target 1.6 but it errored. It was quite simple for me to download the v1.6 sdk so I did that and recompiled and it fixed the problem. I was a bit surprised though because I was not using any v1.7 features as far as I was aware.
5 years ago
I am running tomcat 6, 64 bit on a Windows 7 64 bit platform. I copied my web application (entire folder - it is called cuba4remedy) to a tomcat 6 64 bit installation on a different machine. this one running Windows 2008 standard 64 bit.

The servlet was working fine on my Windows 7 development machine but when I run on the new machine I see this error in the Catalinaxxx.log :-

SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/cuba4remedy,J2EEApplication=none,J2EEServer=none

I don't really understand why I am getting this error. Any ideas anyone?

One more point might be relevant. I compiled on my dev machine using Javac version 1.7. On the machine I copied to only the Java runtime is installed - that is Java version 1.6.
5 years ago

a and b are primitive variables, not reference variables. They directly hold the numerical values we give them.

Can you please clarify?
5 years ago
Here is my code. Repaint doesn't do anything here. Any ideas?

and html

Enter a semi-colon delimited text string
<applet code = "ChoiceWidth.class" width="300" height = "60">

5 years ago

Hare Shiva wrote:I have created an applet and it doesnot access any client files or resources.So in my understanding i donot need to sign it.I am going to host that applet along with my website.My problem is that whenever browser runs that applet at start up it ask for permission.I want the applet to run without such permission.Its a simple applet.How can i achieve it.I have seen other applets that runs automatically in my browser.I want to achieve same like that.Please any suggestion.

Show us your html code hosting the applet and your applet code and someone might be able to comment.

I had all sorts of problems with this when I started. To do mostly with the path to the applet.
5 years ago

Isn't this an error. You are declaring a final value (but not assigning a value). Then you set a value.

I didn't think this was possible if you declare a value final (unless you assign in constructor).

But interestingly in my Java it doesn't give an error.

5 years ago
Your post got me thinking.

So I knocked up this code.

It prints:

Not sure if that answers your question. I would guess that the reference held by a is copied to b.

You may be simplifying the copy operation too much. Probably b=a; means references are copied, not actual values.

Is this homework or something because it is not something that a programmer would generally need to worry about.
5 years ago

Not sure what you're trying to say here, but technically, "same location in memory" has nothing to do with it (although in any normal implementation that's probably exactly what it does). It doesn't check for two objects being equal, and I certainly didn't say that it does. It simply tests whether two refrences point to the same object, or are both null.

You can think of a reference as being a variable which stores the memory location of the actual object.


String name = new String("Jeff");

The String object is stored in memory location 100 say.

variable called name is a variable storing the memory location 100 - this is the 'reference'.

If you now do:

String name2 = name;

then both name and name2 hold reference 100. So when you do

if(name == name2)

it is comparing the memory locations which are equal and so returns true.

I haven't examined the Java source code but I expect it works something like that.

Yes, what you were saying, points to the same object is effectively saying the same thing. I wasn't disagreeing with you.
5 years ago

Mike Simmons wrote:Well, do you declare all your local variables at the beginning of the method, as was traditional for years in many older programming languages? Or do you wait to declare them when they're actually used? I prefer the latter. I'm sure that if I were using a language that made it a pain in the @$$ to declare them later, I could declare them up front like people did for years. But since I use languages where it's trivially easy to put the declaration where it makes the most sense to me, I do so. I see local functions in Scala the same way.

Exactly. I hate it when people get all defensive and say stuff like who needs a feature like that. They just haven't bothered to think it through.

Java just doesn't support this feature yet. End of story. Lots of other languages don't support nested functions either.
5 years ago
Also encapsulation is your friend. Create an isVowel function. Eg
5 years ago

WeiJie Lim wrote:

I am trying to print out the range of odd numbers between the 2 integers entered using the JOptionPane dialog. I have narrowed down the issue to the for loop, but I can't spot the error. It is able to compile, but no result occurs.

What would happen if num1 was less than num2? Think about the condition of your for loop.
5 years ago

Rajiv Rai wrote:

The output for the above code is as follows


How does -41 come out as result of third print statement?

15 - I don't understand that. Hope someone might comment.

0 because Character.getNumericValue() function extracts the integer from the character. So '0' is of course zero.

'0' is ascii value 48 decimal (or 0x30) - see

therefore 7 - 48 = -41

But I am puzzled with the 15 result.


Just looked again at ascii chart. decimal 102 is character f. In hex this can be converted to decimal 15 - so there is that answer.
5 years ago