comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Diff between Runtime and Emulation Environment of personal java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e67baa0f74c3e37 * Java TV API works only with windows NT 4.0 Version? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3060c067f8c49860 * Help with versions in java TV API - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f8eba0c97d15284 * reflection question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f02d54a8d033a403 * JVM shut down ala Eclipse or Jbuilder - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bc2493416cd4232 * how to resize a array? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add * A Record Class Type: Bad Style? - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c123108701741bdf * Cell phones and java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/461d3665e0cf09d0 * Anti-aliasing GIF Images - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cc5fef6d79db9b7 * Correct Semaphore Implementation in Java - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8259aec1ceed4f8f * Tomcat, Apache and Application in / context path - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5b39f1a1691dde * Parsing a Schema to build a JTree - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4522b0f7e93fb2de * Ant vs Makefiles - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767 ============================================================================== TOPIC: Diff between Runtime and Emulation Environment of personal java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e67baa0f74c3e37 ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 12:46 am From: [EMAIL PROTECTED] (samindla venkateswar rao) Hi all, In the Java TV API Reference Implementation it was suggested to use Personal Java RUNTIME Environment 3.1 version...but i found only the source of it and the not the implementation. However i found Personal Java Emulation Environment 3.1 version and it had "classes.zip" in lib directory for which i was searching. Is there any difference between these two Environments? If yes,which exactly should i use for Java TV API Reference Implementation? Again if at all i have to use Personal Java RUNTIME Environment 3.1 version then where can i get this implementation? or is there any other way to run from the source which i have it . Kindly help me...... Thanks, venkatesh ============================================================================== TOPIC: Java TV API works only with windows NT 4.0 Version? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3060c067f8c49860 ============================================================================== == 1 of 2 == Date: Sat, Nov 27 2004 12:47 am From: [EMAIL PROTECTED] (samindla venkateswar rao) Hi all, In java tv api reference implementation it was asked to use windows NT 4.0 Version. I'm using windows 2000 with Service Pack 4. Does Java TV API works only with windows NT 4.0 Version? Please answer...... Thanks, venkatesh == 2 of 2 == Date: Sat, Nov 27 2004 5:43 pm From: "Ann" "samindla venkateswar rao" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > In java tv api reference implementation it was asked to use windows NT > 4.0 Version. I'm using windows 2000 with Service Pack 4. Does Java TV > API works only with windows NT 4.0 Version? > Please answer...... > Thanks, > venkatesh Try it, most NT 4.0 stuff works on 2000. ============================================================================== TOPIC: Help with versions in java TV API http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f8eba0c97d15284 ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 12:48 am From: [EMAIL PROTECTED] (samindla venkateswar rao) Hi all, iam working with javaTV api for 15 days but still i couldn't even run the samples mentioned in the TV API reference implementation like SampleData_01.java in the folder : jtv-1_0-src/javatv_fcs/samples/db TVRef.java in the folder : jtv-1_0-src/javatv_fcs/samples/tv i'm using the following software installed in C: drive 1)jdk 1.2.2 2)jmf 1.1 3)jaxp1.0.1 4)jtv-1_0-src(java tv api reference implementation) 5)personal java Emulation Environment 3.1(pjee3.1....i have a doubt in this.Actually in the reference implementation it was mentioned to use personal java runtime environment but i'm using emulation environment......) My CLASSPATH IS: .;C:\Program Files\JavaSoft\Jaxp1.0.1\jaxp.jar;C:\Program Files\JavaSoft\Jaxp1.0.1\parser.jar;C:\jdk1.2.2\lib\tools.jar;C:\jdk1.2.2\jre\lib\rt.jar;C:\jtv-1_0-src\javatv_fcs\javatv.jar;C:\pjee3.1\lib\classes.zip;C:\jtv-1_0-src\javatv_fcs\lib\;C:\JMF1.1\lib\jmf.jar;C:\JMF1.1\lib\jmfbean.jar; my PATH is :C:\jdk1.2.2\bin;C:\jdk1.2.2\jre\bin;C:\pjee3.1\bin;C:\jdk1.2.2\jtv-1_0-src\javatv_fcs\lib\;C:\jdk1.2.2\lib; my operating system is: windows 2000 with service pack 4 Could anyone tell me the right versions of the above mentioned software to use with Java TV api and also the classpath. thanks in advance, venkatesh... ============================================================================== TOPIC: reflection question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f02d54a8d033a403 ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 8:56 am From: "sks" "Tony Morris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "sks" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > "Daniel Wang" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > How do I invoke a method on a class that does not have any parameters > and > > > returns void? > > > > > > For example, how to invoke this method? > > > > > > public void printHello() > > > { > > > System.out.println( "Hello!" ); > > > } > > > > You get your method with getMethod or getDeclaredMethod if its private / > > package / protected and pass in null for the Class parameter types when > its > > a method with zero args. Invoke it with null again for the object > > parameters. The method will return null if its a void. > > > > It tells you all this in the invoke method javadoc so you looked hard > didn't > > you. > > > > > > You do not pass null. > You pass nothing to the varargs parameter. > > e.g. m.invoke(theObject); Only in 1.5. Before that you do m.invoke(obj, null) or m.invoke(obj, new Object[] {}); And as that's more compatible its best to do it that way. ============================================================================== TOPIC: JVM shut down ala Eclipse or Jbuilder http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bc2493416cd4232 ============================================================================== == 1 of 2 == Date: Sat, Nov 27 2004 12:58 am From: [EMAIL PROTECTED] (Sambucus) Ehh, yes of course, but that will not work for me I'm afraid. I dont know if eclipse/jbuilder uses a native call to end the jvm process? In that case it would be the same as using the task manager, but can you implement that into a Java app? "Ann" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > windows task manager > > "Sambucus" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi all, > > anyone who knows how to force a running jvm to shut down like Eclipse > > or Jbuilder does when you press their little stop button? > > > > I have this problem with some sockets refusing to shut down (I guess > > it is because they are blocking for input). When I run my app from > > eclipse and use a normal System.exit(); or > > Runtime.getRuntime().halt(0); the app refuses to shut down, however, > > if I press eclipses stop/shutdown button it imideatly shuts down the > > jmv and all sockets. I would like to know if there is some way to > > implement this from within my app? > > > > Any help much appritiated! > > > > /Andreas == 2 of 2 == Date: Sat, Nov 27 2004 5:22 pm From: "Ann" "Sambucus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ehh, yes of course, but that will not work for me I'm afraid. > I dont know if eclipse/jbuilder uses a native call to end the jvm > process? In that case it would be the same as using the task manager, > but can you implement that into a Java app? > > "Ann" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > windows task manager > > > > "Sambucus" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hi all, > > > anyone who knows how to force a running jvm to shut down like Eclipse > > > or Jbuilder does when you press their little stop button? > > > > > > I have this problem with some sockets refusing to shut down (I guess > > > it is because they are blocking for input). When I run my app from > > > eclipse and use a normal System.exit(); or > > > Runtime.getRuntime().halt(0); the app refuses to shut down, however, > > > if I press eclipses stop/shutdown button it imideatly shuts down the > > > jmv and all sockets. I would like to know if there is some way to > > > implement this from within my app? > > > > > > Any help much appritiated! > > > > > > /Andreas Use Runtime Taskkill Ends one or more tasks or processes. Processes can be killed by process ID or image name. Syntax taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t] ============================================================================== TOPIC: how to resize a array? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 9:29 am From: Oscar kind nick <[EMAIL PROTECTED]> wrote: > char[][] arr=new char[5][5]; > arr[0][0]='a'; > arr[0][1]='b'; > ........ > > i want to resize (arr) at run time and reserve the original data > what should i do? There are two alternatives - Use George's advice: allocate a new, bigger, array and use System#arraycopy(Object, int, Object, int, int). - Use a List instead. Especially ArrayList is well suited to replace an array. -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ============================================================================== TOPIC: A Record Class Type: Bad Style? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c123108701741bdf ============================================================================== == 1 of 3 == Date: Sat, Nov 27 2004 11:20 am From: "Chris Uppal" Chris Smith wrote: > 3. Instead of using a static method and a nested class, you might > consider placing the counting code inside the same class that > encapsulates the results. Agreed, and that's the way I'd do this. I want to add: You (the OP) may find, once you have properly sorted out the object responsibilities, and created an object with the job of analysing character data, that more of your code "wants" to live in that object. So consider what you are doing with the data after you have collected it, is any of that functionality something that should be part of CharacterCount's (or CharacterAnalysis's) responsibility ? OTOH, you could go completely the other way. As far as I can see, the original NumberOf class existed /solely/ as an optimisation to avoid scanning the string three times. Is that optimisation necessary ? If not then just scan three times and be done with it. Of course, it may well be that you prefer the code structure you get by following Chris's advice and using a proper object, in which case the optimisation is just icing on the cake. Incidentally, the way you categorise your characters seems very ASCII specific -- it will break if you are treating full Unicode, or even just Java's cut-down imitation of it. I don't know if that's just because you brewed up the example simply /as/ an example, or it is representative of your real code, but I thought I'd mention it just in case. Notice, by the way, that once you have created an object whose job is to categorise characters, replacing it with another object, which does the same job but is Unicode aware, should be very easy. -- chris == 2 of 3 == Date: Sat, Nov 27 2004 4:51 pm From: "George W. Cherry" "Hal Rosser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You COULD just return an int array - rather than expose your public > variables. That would be execrable: the user would have to use array indexes (0, 1, or 2) instead of suggestive names for the variables. What is this "indecent exposer" fear you have? George > "George W. Cherry" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> I want to return three named ints from a method. I've done >> it (as shown below) with a class that has three public int >> fields. A pal of mine said this is execrable style. Is she >> right? What would be the elegant received style of doing >> what I want to do? (An old Ada programmer wants to know.) > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004 > > == 3 of 3 == Date: Sat, Nov 27 2004 5:08 pm From: "George W. Cherry" "xarax" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "George W. Cherry" <[EMAIL PROTECTED]> wrote in > message > news:[EMAIL PROTECTED] >> I want to return three named ints from a method. I've done >> it (as shown below) with a class that has three public int >> fields. A pal of mine said this is execrable style. Is she >> right? What would be the elegant received style of doing >> what I want to do? (An old Ada programmer wants to know.) >> >> George (Old Ada Programmer) >> >> public class CountTheCharacters { >> public static class NumberOf { >> public int vowels; >> public int consonants; >> public int others; >> } >> >> public static NumberOf countTheCharacters(String str) { >> NumberOf numberOf = new NumberOf(); >> for (int j = 0; j < str.length(); j = j + 1) { >> char ch = str.charAt(j); >> if ( Character.isLetter(ch) ) { >> switch(ch) { >> case 'a': case 'e': case 'i': case 'o': case 'u': >> case 'A': case 'E': case 'I': case 'O': case 'U': >> numberOf.vowels++; >> break; //end cases for vowels >> >> default: >> numberOf.consonants++; >> //end ch is a letter but not a vowel >> }//end switch statement >> } >> else { //ch is not a letter >> numberOf.others++; >> } >> }//end for loop >> return numberOf; >> }//end countTheCharacters method >> }//end class > > It is alright as is, but I would rather see the NumberOf > object passed as a parameter to countTheCharacters() instead > of creating a new object for every call. Your suggestion is: public static NumberOf void(String str, NumberOf numberOf) My problem with this is that the numberOf object may not have its fields set to zero, and so the method must do that. Why not let the method create the new numberOf object as I did? It seems to me that the method should be the guy who creates the object. The user should call my method this way: NumberOf numberOf = countTheCharacters(str); All of this works because Java guarantees that the int fields of a newly created object are set to zero. > The caller can > then decide when to create a new object. Just be sure to > reset the fields to zero before the for() loop. That will > also allow the caller to use an extension (subclass) of > NumberOf for whatever purpose. > > Two cents worth. Your mileage may vary. Okay, George ============================================================================== TOPIC: Cell phones and java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/461d3665e0cf09d0 ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 12:39 pm From: Lothar Kimmeringer On Thu, 25 Nov 2004 00:41:18 GMT, John Bailo wrote: > Of course, because Sun is another Microsoft in wolf's clothing. Their intend is to earn money, so you're right in some way. But that's every company we see on this earth. >> The facts >> are that the APIs you're using are not available on mobiles. > > I wrote it once. It doesn't run everywhere. > > What happened? You did something wrong. >> Of what class? >> >>> Shouldn't the paint method, and applet init() and so on be transparent >>> across all platforms? >> >> No, since applets are not supported on anything but web browsers. > > So they are useless. I'm writing server-applications and programs for mobile devices, so you're right for me. If you write normal applications, you don't use Applets, either. Applets are "An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application." (taken from the Java-API) So Applets are something special you only use in special environments. >>> A cellphone has a processor and a screen and a "keyboard". >> >> No, it does not have a keyboard. It has a UTI-9 keyPAD. When you put the >> word keyboard into quotes you should have realized your mistake. > > But it should be the job of java to virtualize it -- right ? It does it well. For a Java-application on a mobile device it doesn't matter if the entered text is coming from a keyboard, a keypad or a touchpad with OCR. The underlying hardware is completely different to each other, on the Java-side the code can be written once and runs on every J2ME-enabled mobile device. In fact I was writing applications, that are running on a Nokia 6310i and on a Blackberry without any change. >>> It's a small computer. >> >> So is the remote control for my digital cable box. Should it also run >> your bouncing ball applet? > > YES! That's the whole raison d'etre of java !!!! Obviously you're the only one thinking so (maybe together with some marketing-guys at Intel who are thinking of how to sell more Pentiums). Of course it would be nice to be able to write one application that is running on every single device being developed in past and in the future, but the real life is different to that and for a mobile device it would just be impossible to provide that because of the restrictions it brings. >> No, "they" aren't. They're executing a ROMized image of the MIDlet suite >> in the K virtual machine on the mobile. >> > So it's not really java. Java is a programming language and a plattform. The programming language is always the same, the platform is different. J2SE and J2ME are different ones and therefore there can be differences in programming. BTW. You can program a LEGO Mindstorms roboter with Java as well. How do you suppose should be your bouncing ball applet run on that. A bouncing roboter? > It's something else, and they call it java to get the brand name > recognition. No. What's this thread about anyway? Where you promising to somebody to write an application for a mobile phone thinking it will be enough to implement an applet now all was useless and you don't get payed and are angry about that, or what? Regards, Lothar -- Lothar Kimmeringer E-Mail: [EMAIL PROTECTED] PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions! ============================================================================== TOPIC: Anti-aliasing GIF Images http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cc5fef6d79db9b7 ============================================================================== == 1 of 2 == Date: Sat, Nov 27 2004 2:55 pm From: "Boudewijn Dijkstra" "Kevin Bertman" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] >I have created a Java Dodgems game at > http://www.kevinbertman.co.uk/japan/dodgemsRules.shtml > > Each dodgem is a gif image. Since the applet often rotates each > dodgem, is there a way that I can use anti-aliasing to reduce the > jagged edges? Or can anti-aliasing only be applied to things 'drawn' > like drawLine, fillRect, or drawString? Enlarge the gif files. When drawing, rotate them and then rescale. == 2 of 2 == Date: Sat, Nov 27 2004 4:26 pm From: John Kevin Bertman wrote: > I have created a Java Dodgems game at > http://www.kevinbertman.co.uk/japan/dodgemsRules.shtml > > Each dodgem is a gif image. Since the applet often rotates each > dodgem, is there a way that I can use anti-aliasing to reduce the > jagged edges? Or can anti-aliasing only be applied to things 'drawn' > like drawLine, fillRect, or drawString? They're quite simple shapes. Why not define a dodgem as a shape? Then you can avoid images. JOhn ============================================================================== TOPIC: Correct Semaphore Implementation in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8259aec1ceed4f8f ============================================================================== == 1 of 4 == Date: Sat, Nov 27 2004 8:58 am From: "Matt Humphrey" "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Frank, > > Even ignoring spurious wakeups (which are quite possible in a completely > working virtual machine and obviously require the predicate), there is > this scenario: > > 1. Semaphore is created with count set to 1. > > 2. Thread A executes P() and completes successfully. The count is now > set to 0. > > 3. Thread B enters P(), finds count to be 0, and goes to sleep > (releasing the monitor). > > 4. Thread A executes V(). Count is now 1, and thread B has been moved > from a blocked state to a runnable state. > > 5. Thread C enters P() and executes successfully (remember that Thread A > already incremented the count). The count is now 0 again. > > 6. Thread B is scheduled. It re-acquires the monitor, FAILS to check > count, decrements counts, and leaves. Count is now -1, and your > semaphore has failed. > > You seem to be under the impression that a call to notify() causes the > monitor to be immediately given to the thread receiving the > notification, or that the thread receiving the notification is > immediately scheduled. Neither of those are true; the notified thread > merely becomes runnable, and it competes for a time slice on an equal > basis with any other thread, meaning that (as above) a thread C could > easily be scheduled first. > > Hope that makes (one of) the problem(s) clear. Beautiful example, Chris. It's the best one I've seen for explaining why receiving notify does not imply that the waiting condition has been met. Cheers, Matt Humphrey [EMAIL PROTECTED] http://www.iviz.com/ == 2 of 4 == Date: Sat, Nov 27 2004 5:18 pm From: "Ann" > > <snip> Neither of those are true; the notified thread > > merely becomes runnable, and it competes for a time slice on an equal > > basis with any other thread, meaning that (as above) a thread C could > > easily be scheduled first. > > > > Hope that makes (one of) the problem(s) clear. > > > Beautiful example, Chris. It's the best one I've seen for explaining why > receiving notify does not imply that the waiting condition has been met. > You don't need an example if you just read the book! == 3 of 4 == Date: Sat, Nov 27 2004 5:38 pm From: [EMAIL PROTECTED] In article <[EMAIL PROTECTED]>, Chris Smith <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: >> A JVM that allows "wait" to complete without a corresponding "notify" >> would be broken, no? Can anyone point to evidence that these exist? >> Just curious. > >No, it would absolutely not be broken. Recent versions of the API >documentation even explicitly state that spurious wakeups are possible >for Object.wait(). (Googling for recent API ....) So they do (explicitly state). Good heavens. Well, this isn't how I would have said monitors should work [1], but as long as the behavior is documented (as it is), then I guess JVMs that behave this way can't be considered broken. [1] Then again, a quick attempt to Google up information about how monitors are supposed to work suggests that the original work (Brinch Hansen and Hoare?) describes enough different variations to make it clear that it would be wrong to go all pedantic before reading further. For example (and this is relevant to another point being made in this thread), in some variations, a process/thread suspended on a "wait" *is* guaranteed to resume operation immediately upon getting a "signal"; in others, it's not. (Hm, now that I think about it, this is obviously impossible to implement in a language that permits a "signal all waiting threads" operation -- notifyAll(), e.g.) Very interesting. Supposedly there are discussions of this stuff in Doug Lea's "Concurrent Programming in Java" and Bloch's "Effective Java". Something to check out if/when one has access to these books and a bit of spare time .... [ snip ] >Even without this possibility, predicate loops are always a good idea -- >especially in Java where objects' monitors are often subject to multiple >related uses. For what it's worth, this is what I do in practice -- though usually with a vaguely uneasy feeling that the loop might not really be needed. However, it appears that in fact it *is* .... Interesting. -- | B. L. Massingill | ObDisclaimer: I don't speak for my employers; they return the favor. -- -- blm == 4 of 4 == Date: Sat, Nov 27 2004 10:46 am From: "Mike Schilling" "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fortunately, in the current version of > Java, there is already a Semaphore class available in > java.util.concurrent, and I would bet money that it actually works, Since it's Doug Lea's code from _Concurrent Programming in Java_, and had been both widely discussed and widely used for several years before being put into the JDK, I wouldn't take that bet. ============================================================================== TOPIC: Tomcat, Apache and Application in / context path http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5b39f1a1691dde ============================================================================== == 1 of 1 == Date: Sat, Nov 27 2004 3:32 pm From: dundonald Juha Laiho <[EMAIL PROTECTED]> thoughtfully wrote: >[EMAIL PROTECTED] (Joshua) said: >>Juha Laiho <[EMAIL PROTECTED]> wrote in message >>news:<[EMAIL PROTECTED]>... >>> [EMAIL PROTECTED] (Joshua) said: >>> >I have Apache configured with Tomcat using mod_jk2. For example: >>> > >>> >Apache runs on port 80 >>> >Tomcat runs on port 8080 >>> > >>> >I can access Tomcat resources by connecting to port 80 through apache. >>> > >>> >I have deployed a war file using the Tomcat Web Application Manager. >>> >This by default uses the name of the war file as its context path. >>> > >>> >What I want is to deploy an application in Tomcat so that when I >>> >access http://<address> on the default port 80 the webapp is served >>> >instead of http://<address>/<context path>/. >>> >>> Two choices; >>> 1. >>> - you could set up Apache so that requests to anything (except starting >>> with /<context path>/ are redirected either internally or externally >>> to resources within /<context path>/ >> >>I've done some more digging around to try get this option working. >>I've read up about ProxyPass in Apache. I have entered something like >>the following in my httpd.conf: >> >>ProxyPass / http://<address>:8080/<context path>/ >> >>What this does now is requests are going through apache but under the >>covers Tomcat is serving the content. Is this the method you had in >>mind? An issues to be aware of with this? > >It's some time since I played with redirections (and it was w/Apache 1.3), >and I recall there's another way, too - and so that you wouldn't be >dependent on the 8080 port of Tomcat, but would still be using the mod_jk2. >Hmm.. have you tried ProxyPass'ing to the Apache itself - i.e. to >http://<address>/<context path>/ ? > >>Only concern I have with this is, and it might not be an issue because >>I wont necessarily have other webapps on this server, it is no longer >>possible to access a web app from tomcat through apache - e.g. >>http://<address>/<context path>. > >Even that shouldn't be an issue - as long as you ProxyPass the other >contexts before the root context. > >But still I recall there were other ways -- perhaps even simple Alias >directives would do? There was a lot of farting around with the proxy pass. It worked well, but the JSP's were still requesting servlets from the root context. So in the end I deployed the application to the root context of tomcat. There's now no need to use proxy pass at all. Instead apache running on port 80 uses mod jk2 to call tomcat on port 8080. All working ok now. Thanks. -- ============================================================================== TOPIC: Parsing a Schema to build a JTree http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4522b0f7e93fb2de ============================================================================== == 1 of 2 == Date: Sat, Nov 27 2004 8:09 am From: [EMAIL PROTECTED] (Dj Frenzy) Hi, I'm writing an XSLT generation tool in Java, and at the moment and working on a facility to display the hierarchical structure of a XML Schema. I know there are examples availible on the net for building a JTree from an XML file, but does anyone know of any existing programs which will build a JTree for a schema? Cheers David == 2 of 2 == Date: Sat, Nov 27 2004 9:33 am From: Chris Smith Dj Frenzy <[EMAIL PROTECTED]> wrote: > Hi, I'm writing an XSLT generation tool in Java, and at the moment and > working on a facility to display the hierarchical structure of a XML > Schema. > > I know there are examples availible on the net for building a JTree > from an XML file, but does anyone know of any existing programs which > will build a JTree for a schema? I can't point you to publically available code, but I have done something very close to this and can give advice. Specifically, you ought to write your own model class instead of using DefaultTreeModel, and use org.w3c.dom.Element directly as your tree node objects. If you use a parser that implements the DOM Events spec, it's fairly simple to have your model listen for events on the DOM document and translate them into the appropriate TreeModelEvent. Finally, you'll need to install a TreeCellRenderer that's capable of drawing the items in the way you want (since DOM Element instances aren't guaranteed to override toString()). This isn't terribly difficult, and I can answer any questions you have here on the newsgroup. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Ant vs Makefiles http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767 ============================================================================== == 1 of 4 == Date: Sat, Nov 27 2004 5:09 pm From: "Ann" "Sudsy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ann wrote: > > "Harris L" <[EMAIL PROTECTED]> wrote in message > <snip> > >>Please note that I am not particularly familiar with either (Makefile > >>or Ant). > >> > >>If any of you has any suggestions, pointers or references of how to do > >>this that it would be greatly appreciated. > >> > >>Regards, > >>Harris > > > > > > Is there a reason/justification to use Ant? Other than 'cuz' of course. > > Make is a superb tool for building applications/executables in the > structured programming, *NIX environment. It properly resolves > dependencies and builds only what is needed. > It doesn't do such a good job with Java, where compilation doesn't > preclude cyclical dependencies. It doesn't incorporate the features > to handle the situation. You can jury-rig something, with bailing > wire and duct tape, but it's going to be fragile. > Ant handles the situation with aplomb, although it is saddled with > the usual criticisms (valid) about slow initial start-up. > So it's not 'just becase'. Use make if your code is C or C++. Use > ant if your code is Java. > Every tool has its place; ever try to loosen a 1/2" nut with a > screwdriver or needle nose pliers? ;-) > Great, then maybe you can suggest a solution for me since I am new to Ant. I have a file that contains mostly constants. When it changes there are a dozen other files that must be recompiled. TIA Ann == 2 of 4 == Date: Sat, Nov 27 2004 6:35 pm From: "Mike Schilling" "Ann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Great, then maybe you can suggest a solution for me since I am > new to Ant. I have a file that contains mostly constants. When > it changes there are a dozen other files that must be recompiled. It's funny, but for all of its reputation as the premier build tool for Java, Ant doesn't do thorough dependency checking. It assumes that XXX.java is the only input to XXX.class. The only command-line tool I know of that does a better job is jikes, which can be used with or without make (see http://bekaffe.sourceforge.net/documentation/jikes/jikes.html#make). == 3 of 4 == Date: Sat, Nov 27 2004 10:39 am From: Joe In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Great, then maybe you can suggest a solution for me since I am > new to Ant. I have a file that contains mostly constants. When > it changes there are a dozen other files that must be recompiled. > TIA > Ann > If your constants are changing, then they aren't really constant are they? == 4 of 4 == Date: Sat, Nov 27 2004 7:41 pm From: "Christian Hvid" Anzime wrote: > ... > > Figure out what the makefile(s) is/are doing, then do the same using > Ant. You'll have to read the ant docs to figure out how to use Ant. > > http://ant.apache.org > Strangely enough. I find subtle wisdom in that answer, eventhough it might seem a bit obvious. If you have a Java project that uses make, then it is most likely written quite some time ago and/or it is written by someone with a C background and a limited Java understanding. Either case you would want to completely review your project's build process. Do not translate the make file(s) line-by-line into a ant file. As the poster wrote. You need to figure what the makefiles are doing (from a top-down perspective), and then do (approximately) same thing with ant. But be very critical of how the source code and built files are organised in the original make environment, very likely it will be done in a way that is uncommon and unconstructive in a Java environment. I have pasted in a build file from one of my own projects. As an example of some of the things you can very easily using ant. The build file compiles sources from the src directory into classes using a classpath with all jars in the lib directory, then packages the classes with ressources from res and metainformation from etc into a single jar file. There is an additional test target that runs a test class using the generated classpath. Also beware many deployment tasks such as servlet container control and file transfer can be automated using specialised ant tasks. -- Christian http://vredungmand.dk <project name="octopod" default="dist" basedir="."> <!-- set global properties for this build --> <property name="project" value="lightweight"/> <property name="src" value="src"/> <property name="build" value="classes"/> <property name="build.compiler" value="jikes"/> <property name="doc" value="javadoc"/> <property name="lib" value="lib"/> <property name="dist" value="."/> <property name="etc" value="etc"/> <property name="res" value="res"/> <property name="project-class-id" refid="project.class.id"/> <!-- throw everything inside lib in the classpath --> <path id="project.class.id"> <pathelement path="${classpath}"/> <fileset dir="${lib}"> <include name="**/*.jar"/> </fileset> </path> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> </target> <target name="compile" depends="init"> <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}" nowarn="on"> <classpath refid="project.class.id"/> </javac> </target> <target name="test" depends="dist"> <exec executable="java"> <arg line="-cp ${project}.jar:${project-class-id} test.Main"/> </exec> </target> <target name="dist" depends="compile"> <mkdir dir="${dist}" /> <jar manifest="etc/manifest.mf" jarfile="${project}.jar"> <fileset dir="${build}"/> <fileset dir="${res}"/> </jar> </target> <target name="clean"> <!-- Delete the ${build} and ${dist} directory trees --> <delete dir="${build}"/> <delete dir="${test}"/> </target> <target name="javadoc"> <delete dir="${doc}"/> <mkdir dir="${doc}"/> <javadoc packagenames="*.*" sourcepath="${src}" excludepackagenames="test.*" defaultexcludes="yes" destdir="${doc}" author="true" version="true" use="true" windowtitle="Octopod"> <doctitle><![CDATA[<h1>Octopod</h1>]]></doctitle> <bottom><![CDATA[<i>2004 by Christian Hvid.</i>]]></bottom> <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/> </javadoc> </target> </project> ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
