comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * jsp standalone - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e96457c73f1eae3a * Changing the time an application runs. - 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf6870bc3893f10a * Can't display Java gui - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70509f2693ffc62a * LinkageError and ExceptionInInitializerError - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9ef5241501d452ba * Object reference side effects - desirable? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/294afbcaabeb8325 * What is a Package in Java? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e73247896cdb4d4 * Best JBoss documentation source? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6296226c398df8fb * Difficulties with component events - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a521cb5c55ab6b96 * Jakarta HttpClient POST question - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/454a24836108467a * Terminating a process tree - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7dd1ce1cb22f1ca * Deep nested static class - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed5e27a6f4900324 * runtime.getRuntim().exec(somecmd) problem with linux - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3f83ceedc3184b0 * Design problem: MVC - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5a48d60f28932e2a * Capturin JFrame Content to A Graphic File - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c051b49cec50e1df * EJB container manager transaction - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ee70d0b01dce235 * question about chat system - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21d12a9867e90275 * Node value in a DOM model - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6ad224790943b9f * Two JFrames, one dialog - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b82885ddec2ae08d * Is instanceof dirty? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/395347a70489adef ========================================================================== TOPIC: jsp standalone http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e96457c73f1eae3a ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 7:22 am From: "Brusque" <[EMAIL PROTECTED]> "steph" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > With an embeded tomcat and httpclient for example ? why not. > But I thought that's a bit huge to run a webserver for my "little" problem of > templating. > > More widely, is there any simple api to have a templating mechanisme in a > standalone application ? Have a look at Velocity http://jakarta.apache.org/velocity/ It's more generic, not soley web/servlet based like jsp ========================================================================== TOPIC: Changing the time an application runs. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf6870bc3893f10a ========================================================================== == 1 of 5 == Date: Mon, Nov 8 2004 7:26 am From: Andrew Thompson <[EMAIL PROTECTED]> On Mon, 08 Nov 2004 14:56:39 GMT, End User wrote: > I'm not a java programmer, End users generally get better, and more polite answers on a different Java group described here.. <http://www.physci.org/codes/javafaq.jsp#cljh> > ...so bear with me. Sure, ..if I feel like it. > The question is short and simple. How do I change the time, set for a > program to exit? ... > There is a java applet demo of streaming delayed quotes: .. > http://finance.lycos.com/qc/livecharts/default.aspx?symbols=IBM > It exits the demo after about three minutes. While checking the Sun Java > Console in my Internet Explorer, I noticed a line that said: "URL = > http://finance.lycos.com/qc/livecharts/ot_timedout.html time= 180000", which > I suspect to be the culprit. Yep, I expect configured by this parameter in the source code of the HTML <param name="irritantURL" value="http://finance.lycos.com/qc/livecharts/ot_timedout.html?timeout=3" /> > If so, how can I eliminate that? The answer to that is pretty simple. Change that value in the source of the page from which you host the applet. Of course, you might also need to set up the D/B ..whatever is feeding the data, but that should (in principle) work. >..Is it possible to change the time to a > much greater value, or delete the limitation altogether? Alternately, you might try indeed following the advice in the page that is produced.. "Get the best of Wall Street information streamed right to your desktop. Sign up for your free trial today." Or, given the subject matter. "It takes money - to make money" ;-) > Thanks in advance for any assistance! You're welcome. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 2 of 5 == Date: Mon, Nov 8 2004 7:35 am From: Chris Smith <[EMAIL PROTECTED]> End User wrote: > I'm not a java programmer, so bear with me. > > The question is short and simple. How do I change the time, set for a > program to exit? That obviously depends on the program itself. If you don't have access to the source code for the program, it's quite unlikely that you'll be able to do this. In this case, it looks very much like it would be illegal for you to do so, anyway. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 5 == Date: Mon, Nov 8 2004 8:03 am From: "End User" <[EMAIL PROTECTED]> Thank you both for the prompt responses. I tried to change the value in the page source from 3 to something bigger, save the text file with an html extension, and load the new file. It wouldn't work. I then tried to save the file from Internet Explorer (using "Web Page, complete), but would always get an error message: "Error Saving Web Page" "This Web page could not be saved." Lost case? I noticed that in the Sun Java Console of my Internet Explorer, the value used is: time= 180000, while in the web page source, which appears in IE under: "View ---> Source", the line says http://finance.lycos.com/qc/livecharts/ot_timedout.html?timeout=3, where I guess the "3" means three minutes, and something tells me it's the same as the 180000. All is well and good, the only problem is I still don't know how to change it. == 4 of 5 == Date: Mon, Nov 8 2004 9:11 am From: Andrew Thompson <[EMAIL PROTECTED]> On Mon, 08 Nov 2004 16:03:33 GMT, End User wrote: > Lost case? Lost 'cause'. Yes ..apparently. ;) -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 5 of 5 == Date: Mon, Nov 8 2004 9:50 am From: "End User" <[EMAIL PROTECTED]> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 08 Nov 2004 16:03:33 GMT, End User wrote: > >> Lost case? > > Lost 'cause'. > > Yes ..apparently. ;) Bummer! I hoped there were applications that can change the memory registry. Thanks anyway! ========================================================================== TOPIC: Can't display Java gui http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70509f2693ffc62a ========================================================================== == 1 of 3 == Date: Mon, Nov 8 2004 7:43 am From: [EMAIL PROTECTED] (Conrad Eaglehill) Hi. I'm using sendmail 8.12.9 for a project on RedHat Fedora Core 2 on my personal computer with a perfectly functioning X window server. Part of this project requires me to modify sendmail to open a Java gui application. When I attempted this originally, I got the following error: "No X11 DISPLAY variable was set, but this program performed an operation which requires it." Figuring that sendmail for whatever reason unset it, I called the C function setenv() in sendmail to set it and got the following error: "Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable." Using the command-line imperative "-Djava.awt.headless=true" for the Java program gives the following message: "Exception in thread "main" java.awt.HeadlessException." Looking into the problem, I found that when running as root, lots of people have had the same problem, and their solution was "don't run as root." Sendmail needs root permissions for some things, so this isn't an option for me. I wonder if anyone know how to run a Java application that needs the X-Window server as root, (or perhaps would allow me to run a Java gui from sendmail as another user temporarily). Thanks in advance, Conrad Eaglehill == 2 of 3 == Date: Mon, Nov 8 2004 8:38 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Conrad Eaglehill wrote: > Looking into the problem, I found that when running as root, lots of > people have had the same problem, and their solution was "don't run as > root." Sendmail needs root permissions for some things, so this isn't > an option for me. I wonder if anyone know how to run a Java > application that needs the X-Window server as root, (or perhaps would > allow me to run a Java gui from sendmail as another user temporarily). I can't really see why anyone would like to start a GUI from a background daemon like sendmail (especially, because there is no guarantee that anyone is looking at the display), but well ... To change your effective user user id, see: man su man sudo But if you really need to alert someone from sendmail (why?), consider using something like wall or syslog, or sending a pager/SMS message. /Thomas == 3 of 3 == Date: Mon, Nov 8 2004 9:05 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Conrad Eaglehill wrote: > I'm using sendmail 8.12.9 for a project on RedHat Fedora Core 2 on my > personal computer with a perfectly functioning X window server. Part > of this project requires me to modify sendmail to open a Java gui > application. When I attempted this originally, I got the following > error: "No X11 DISPLAY variable was set, but this program performed an > operation which requires it." Figuring that sendmail for whatever > reason unset it, I called the C function setenv() in sendmail to set > it and got the following error: "Exception in thread "main" > java.lang.InternalError: Can't connect to X11 window server using > 'localhost:0.0' as the value of the DISPLAY variable." Using the > command-line imperative "-Djava.awt.headless=true" for the Java > program gives the following message: "Exception in thread "main" > java.awt.HeadlessException." > > Looking into the problem, I found that when running as root, lots of > people have had the same problem, and their solution was "don't run as > root." Sendmail needs root permissions for some things, so this isn't > an option for me. I wonder if anyone know how to run a Java > application that needs the X-Window server as root, (or perhaps would > allow me to run a Java gui from sendmail as another user temporarily). Are you fork()ing a new process in which to launch the GUI? You ought to be able to have that process change its euid and egid to non-privileged ones, prior to exec()ing the JVM. Also, some of the various exec calls allow you to specify the environment for the new executable; this avoids unnecessarily propagating environment variables, as well as giving you an easy hook for inserting new variables required by the exec()ed program. Or are you running it via the system() call? That's basically a wrapper around the exec()-based technique; you could write your own replacement that does what you want. Alternatively, if you're spawning the Java program that way then you may want to look into using su -c. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: LinkageError and ExceptionInInitializerError http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9ef5241501d452ba ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 7:55 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Boaz wrote: > I have a program (not mine) that throws ExceptionInInitializerError > and I'm trying to figure out what it means. I saw the short > documentation in Sun's Java api but I'm looking for something more > descriptive about it and its parent - LinkageError. > > If anyone can shed some more light or direct me to some place on the > net I'll be greatful. ExceptionInInitializerError means exactly what its name says: an exception was thrown by a class' initialization code. The initialization code consists of the initialization expressions of all static variables plus any static initialization blocks belonging to the class. The compiler will reject initialization code that has the capability of throwing a checked exception, but it cannot avoid the possibility of initialization code throwing an unchecked exception. (It is also conceivable that some class used by another class' initialization code is modified so that it throws checked exceptions where it didn't previously, thus potentially sidestepping the compile-time check.) The definitive source of information about this topic would be the Java Virtual Machine Specification, although a Java-centric description is also provided in the Java Language Specification (http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44487). In the JLS you might want to look specifically at section 12.4.2. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Object reference side effects - desirable? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/294afbcaabeb8325 ========================================================================== == 1 of 2 == Date: Mon, Nov 8 2004 7:55 am From: "VisionSet" <[EMAIL PROTECTED]> "Michael Rauscher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > And > if one needs a copy of a domain object, he has to ask the control object > to return one... > Thanks. Should the word 'copy' be stressed here. -- Mike W == 2 of 2 == Date: Mon, Nov 8 2004 9:18 am From: "VisionSet" <[EMAIL PROTECTED]> "Michael Rauscher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] And another question. Where does the reference to the base domain objects go? eg Accounts can be aggregated in a collection class, but where does the (base) collection object reference go? Do I have a DomainSingleton class and put my base collection object in that? Certainly doesn't seem right to put in a control object. -- Mike W ========================================================================== TOPIC: What is a Package in Java? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e73247896cdb4d4 ========================================================================== == 1 of 2 == Date: Mon, Nov 8 2004 7:59 am From: [EMAIL PROTECTED] Chris Smith <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Katerina MacLean wrote: > > What is a package in java? > > Riippp ... > > The primary purpose of a package is to avoid naming conflicts. Teeaaarrr ... > > Packages also play a role in access control specifiers and in the Java > security architecture with package sealing. These are secondary to the > main purpose of a package. Hi, Chris! Yes, a namespace is a collection of unique names, and a package is the Java implementation of a namespace, but it seems odd to describe this as the primary use of packages (let's call this the name-collision use). Surely, that packages encapsulate closely-related classes from other, less closely-related classes is the primary use of packages in Java (let's call this the encapsulation-use). To take an extreme example: let's say we have 100 classes, three of which have the same name, "Sausage." If the naming-collision use were the primary use, then we could divide our system into three packages: one will have 98 classes, and other two will have one class each. Most Java I have seen, however, divides the system into packages in which the implementation of related functionality is hidden away from the rest of the system; the package name is sort-of a short-hand for the contained functionality. OK, so this is so extreme as to be stupid: and you said that the name-collion use was the, "Primary," use, not the, "Only," use. But, from your signature, you're a Java-course designer: so if you're teaching kids Java and you could only tell them one use for Java packages, would you tell them the name-collision use, or the encapsulation-use? And doesn't this decide what use is primary? May your battles be as savage as they are victorious, as our Klingon friends say, .ed www.EdmundKirwan.com - Home of The Fractal Class Composition == 2 of 2 == Date: Mon, Nov 8 2004 8:19 am From: Chris Smith <[EMAIL PROTECTED]> [EMAIL PROTECTED] wrote: > Hi, Chris! > Hi. > Yes, a namespace is a collection of unique names, and a package is the > Java implementation of a namespace, but it seems odd to describe this > as the primary use of packages (let's call this the name-collision use). Indeed, I can see that I caused some confusion. For whatever reason, I was thinking in language lawyer mode at the time I write that. Certainly there are a number of justifications for the use of packages, and grouping related classes together is an important one. It didn't seem as important at the time because it isn't a functional use of package, but rather a communicative use. In the end, the two are related anyway, and it encompasses both to say that packages group related classes together and in so doing, they provide some context to qualify the class names. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Best JBoss documentation source? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6296226c398df8fb ========================================================================== == 1 of 2 == Date: Mon, Nov 8 2004 8:04 am From: Andrea Desole <[EMAIL PROTECTED]> After playing with JBoss for a while, I would really like to get some good documentation. I have a book here ("JBoss Administration and Development"), but it looks a bit old, and not really complete. I looked at some books to buy, but they all appear to be slighlty old. The site offers a documentation subscription, but someone is guessing that it might not actually give much more. Besides the code itself (and changing container), the only option that looks viable at the moment is just to look on the net, which is what I've been doing so far. Has anyone experience/tips about good documentation with JBoss? Thanks Andrea == 2 of 2 == Date: Mon, Nov 8 2004 9:22 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Andrea Desole wrote: > After playing with JBoss for a while, I would really like to get some > good documentation. > I have a book here ("JBoss Administration and Development"), but it > looks a bit old, and not really complete. I looked at some books to buy, > but they all appear to be slighlty old. The site offers a documentation > subscription, but someone is guessing that it might not actually give > much more. Besides the code itself (and changing container), the only > option that looks viable at the moment is just to look on the net, which > is what I've been doing so far. > Has anyone experience/tips about good documentation with JBoss? I have not obtained the JBoss docs myself so I cannot personally vouch for them, but I have heard from some that they are fairly good. They need to be, because JBoss depends on selling docs for its operating capital. Unless you're on an especially tight budget, I'd suggest that you buy at least some of the JBoss docs. Even if they were to turn out to be less helpful than you hope, you would still be supporting a project that you are evidently benefiting from. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Difficulties with component events http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a521cb5c55ab6b96 ========================================================================== == 1 of 2 == Date: Mon, Nov 8 2004 8:05 am From: "John C. Bollinger" <[EMAIL PROTECTED]> DeMarcus wrote: > > > DeMarcus wrote: > >> >> Hi, >> >> How can I detect mouseclicks outside my component >> without having to know about all other components >> existing? >> >> Thanks. >> Daniel >> >> > > I found some interesting way of detecting the mouse > clicks with the following code. > > getRootPane().getGlassPane().setVisible( true ); > getRootPane().getGlassPane().addMouseListener( this ); > > But now that glassPane steals every mouse event. I just > wanna snoop the events. Does anyone have an idea how > I forward the events to where they belong? You cannot easily "forward" events the way I think you mean. It is much more straightforward to allow the correct component to generate the correct event in the first place. You might instead consider JFrame.getTookit().addAWTEventListener(), which I think will let you do what you want with much less hassle. John Bollinger [EMAIL PROTECTED] == 2 of 2 == Date: Mon, Nov 8 2004 9:27 am From: DeMarcus <[EMAIL PROTECTED]> John C. Bollinger wrote: > DeMarcus wrote: > >> >> >> DeMarcus wrote: >> >>> >>> Hi, >>> >>> How can I detect mouseclicks outside my component >>> without having to know about all other components >>> existing? >>> >>> Thanks. >>> Daniel >>> >>> >> >> I found some interesting way of detecting the mouse >> clicks with the following code. >> >> getRootPane().getGlassPane().setVisible( true ); >> getRootPane().getGlassPane().addMouseListener( this ); >> >> But now that glassPane steals every mouse event. I just >> wanna snoop the events. Does anyone have an idea how >> I forward the events to where they belong? > > > You cannot easily "forward" events the way I think you mean. It is much > more straightforward to allow the correct component to generate the > correct event in the first place. You might instead consider > JFrame.getTookit().addAWTEventListener(), which I think will let you do > what you want with much less hassle. > > > John Bollinger > [EMAIL PROTECTED] Great Thanks! One could say that was _exactly_ what I was looking for. Thanks. ========================================================================== TOPIC: Jakarta HttpClient POST question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/454a24836108467a ========================================================================== == 1 of 3 == Date: Mon, Nov 8 2004 8:09 am From: "Wil Hadden" <[EMAIL PROTECTED]> "Andy Flowers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If that is the case then take a look at the source > (http://jakarta.apache.org/commons/httpclient/downloads.html) > > You could then look at how to implement a subclass of PostMethod and can > override the generateRequestBody() function to generate the data in the way > you want. > I had thought I may have to do something like that, but I thought I'd check that there are no methods to turn on-off encoding. Thanks for the pointer. Wil == 2 of 3 == Date: Mon, Nov 8 2004 8:33 am From: Andrea Desole <[EMAIL PROTECTED]> Thomas Weidenfeller wrote: > Wil Hadden wrote: > >> When the POST is done the data is encoded ( urlencoded? ) to their %40 >> counterparts, > > > Which is standard compliant, RFC1738. I suggest you properly decode the > data. mmmm, rfc 1738 is also valid for post data? > >> but I don't want them to be, I want them >> transmistted in ther original form. > > > Which is not standard compliant. And I doubt they will change the > standard, just because you want it. > > If Jakarta supports this (I never checked), switch to > multipart/form-data. But then you have to decode MIME in the responses. i haven't tried it, but maybe the http client in jakarta commons can help: http://jakarta.apache.org/commons/httpclient/charencodings.html == 3 of 3 == Date: Mon, Nov 8 2004 8:50 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Wil Hadden wrote: > "Thomas Weidenfeller" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Wil Hadden wrote: >> >>>When the POST is done the data is encoded ( urlencoded? ) to their %40 >>>counterparts, >> >>Which is standard compliant, RFC1738. I suggest you properly decode the >>data. >> >> >>>but I don't want them to be, I want them >>>transmistted in ther original form. >> >>Which is not standard compliant. And I doubt they will change the >>standard, just because you want it. >> >>If Jakarta supports this (I never checked), switch to >>multipart/form-data. But then you have to decode MIME in the responses. >> >>/Thomas > > > While you are technically correct that that is the standard I doubt if > whoever wrote the server I am posting to will change their software, just > because I would like them to. Perhaps not, but without knowing any particulars I would suggest that you file a bug report. You might (or might not) be surprised by the result. If the current implementation is provably nonstandard, and if that hurts its interoperability, then you may find the developer(s) responsive. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Terminating a process tree http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7dd1ce1cb22f1ca ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 8:31 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Wayne Marrison wrote: > I have been programming in java for about 2 months, and am currently trying > to control an external application that I start using: > > Process proc; > Runtime rt; > > proc = rt.exec("java.exe -cp ... etc.. something"); > > Then I capture the input/output & error streams and thread them off. No detail there, but it sounds like a correct approach. Do you really need to spawn a new VM for this, though? Perhaps there are reasons why you do need to do (or at least, reasons why it's convenient), but in many cases it would work as well or better to just start up a new thread in the current VM for an "external" Java process. > The problem I have, is that I need to architect for the eventuality of the > external process locking up and not responding to requests. I have the > whole capturing of streams in a timeout, so I can tell when the external > program has not responded within a reasonable time, however when I issue the > proc.destroy() method, the java.exe process takes up almost 100% cpu and _Which_ java.exe? You have (at least) two. Not that it makes much difference. > never stops. I have to use operating system tools to perform a manual kill > of the process. If the external process is unable to respond to requests then it may be in a state where it is unable to respond to the OS' normal signals to shut down, either. > I can only assume that the proc.destroy() doesnt kill the entire process > tree, and because the command line starts off java.exe, which runs the > something.class file, a process is orphaned somewhere. You are inappropriately mixing scope / terminology. From the OS' point of view, the program running is java.exe. Period. That particular program will typically be multithreaded, but the OS has no sense or specific knowledge of the particular class files from which the VM is drawing code to execute. It may be in your case that some thread of that process is refusing to die, but that would be an OS- and state- dependent property of the Java program, with some dependency on the OS-dependent implementation of Process.destroy(). It is outside the scope of the specification of Process.destroy(). My recommendation would be to fix the external program, if that is possible, and to avoid using Process.destroy(). You may be able to simply abandon a deadlocked external program, although that's not very clean. A cleaner approach might be to spawn the "external" program _inside_ the host VM (in its own thread), probably with the use of an appropriate ClassLoader so as to isolate the external program from the host. Make the external app's thread a daemon thread so that it will (in principle) not prevent the host from shutting down (and shutting it down) if it locks up. The one problem this cannot solve is that of forcing the external app to relinquish resources it has locked, such as TCP ports. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Deep nested static class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed5e27a6f4900324 ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 8:43 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Koos Pol wrote: > Andy Flowers wrote (Monday 08 November 2004 14:26): > > >>If bar() is only valid in the context of foo how about using >>classes ? > I've considered that but I hate it to see bar() taken out of the > foo() context. bar() doesn't have a need to exist outside foo(). Then you are characterizing the foo() problem wrongly. In Java, classes are the principal unit of code encapsulation, and objects are the principal unit of data encapsulation. You are focusing on a desired solution and trying to fit it to Java, instead of seeking the best Java idiom for accomplishing your task. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: runtime.getRuntim().exec(somecmd) problem with linux http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3f83ceedc3184b0 ========================================================================== == 1 of 3 == Date: Mon, Nov 8 2004 8:55 am From: [EMAIL PROTECTED] (wex) [EMAIL PROTECTED] (Ian A. Mason) wrote in message news:<[EMAIL PROTECTED]>... > You need to avoid Java parsing the String. You need to parse it yourself > and use the > > public Process exec(String[] cmdarray) > > method of Runtime. I have used this many a time with commands > whose path contains spaces. I tried this and could not get it to work. See below for example if what I tried. What am I doing wrong? >> Because just running the simple >> command: >> String[] cmd = {"/path with space/somecommand"}; >> runtime.getRuntim().exec(cmd); >> Gives me the io exception, it is as if the command is tokenized again >> somewhere in the native code. == 2 of 3 == Date: Mon, Nov 8 2004 8:13 am From: Gordon Beaton <[EMAIL PROTECTED]> On 8 Nov 2004 08:55:50 -0800, wex wrote: > I tried this and could not get it to work. See below for example if > what I tried. What am I doing wrong? If you still can't get it to work, post *real* code and the *real* command line, not just snippets with a placeholder command. /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e == 3 of 3 == Date: Mon, Nov 8 2004 9:21 am From: Andrew Thompson <[EMAIL PROTECTED]> On 8 Nov 2004 08:55:50 -0800, wex wrote: > See below for example if what I tried. That is BS.. >...What am I doing wrong? 1st, you are typing snippets of code that are 'something like' what your code actually is, but THEY ARE NOT YOUR CODE.. Let's look at your 'example' .... >>> String[] cmd = {"/path with space/somecommand"}; >>> runtime.getRuntim().exec(cmd); This would not compile, since there is no method 'getRuntim()'. I suggest you stop wasting the time of the people trying to help you, and posting an *exact* *copy/paste* *example* of what you are doing, from start to finish. Read this carefully.. <http://www.physci.org/codes/sscce.jsp> You should be able to make a complete, compilable example in under 25 lines. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ========================================================================== TOPIC: Design problem: MVC http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5a48d60f28932e2a ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 8:57 am From: Andy Hill <[EMAIL PROTECTED]> Albert <[EMAIL PROTECTED]> wrote: >Well, I'm developing a website where the content is dynamically >included.It's my first jsp project so I've got some - probably basic >-questions. >A jsp page is divided in some areas like content, navigation etc. >Content -as an example - is dynamically included and should display some - >I call them - blocks. >A block is for example an image, a list and a headline. So content can >have 1 to many blocks. >So a page ->content->block->image >I'm using the MVC pattern so my first approach was that my controller >servlets passes to the jsp page an object called model and the jsp page >gets >the data out of it. >Because of the structure this gets very ugly like: >Page onepage = (Page) model.getPage(); >and then >(Area) onearea = (Area) onepage.getArea('content'); >and so on... >The second problem is how do I pass the needed objects to the includes..? >Actually the jsp-page gets the object and writes it into the request with >setAttribute and the included page pulls them out.. >But this looks horrible.. >Thanks for any advice! > Instead of re-inventing the wheel, have you looked into using Jakarta Struts? It's already an MVC architecture (well, in a manner of speaking, anyhow), and addresses most of the problems you've posed. ========================================================================== TOPIC: Capturin JFrame Content to A Graphic File http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c051b49cec50e1df ========================================================================== == 1 of 2 == Date: Mon, Nov 8 2004 9:30 am From: "Mika Stenberg" <[EMAIL PROTECTED]> Can anyone help me out here: Im producing an image on a JFRAME by using a JUNG library (jung.sourceforge.net). Im hoping to dump this picture out on HD as JPG or PNG. How would I do that? Thanks a lot, Mika == 2 of 2 == Date: Mon, Nov 8 2004 9:49 am From: Andrew Thompson <[EMAIL PROTECTED]> On Mon, 8 Nov 2004 19:30:12 +0200, Mika Stenberg wrote: > Im producing an image on a JFRAME .. JFrame (please don't SHOUT) > ..Im hoping to dump this picture out on HD as JPG or PNG. > > How would I do that? You will probably find some examples on Marco Schmidt's page set you on the right track.. <http://www.geocities.com/marcoschmidt.geo/java-image-file-code-examples.html> BTW - X-posting to .. comp.lang.java.gui, comp.lang.java.programmer, fj.comp.lang.java, pl.comp.lang.java is too wide a cross-post for this. I doubt that fj.comp.lang.java and pl.comp.lang.java are in any way valid/useful groups in any case. For information on the best groups, check here.. <http://www.physci.org/codes/javafaq.jsp#groups> * Not: Follow-ups set to c.l.j.GUI. * -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ========================================================================== TOPIC: EJB container manager transaction http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ee70d0b01dce235 ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 9:33 am From: "Grzegorz Trafny" <[EMAIL PROTECTED]> "ShadowMan" wrote: > I have a stateles EJBSession that uses container managed transactions. > This EJB acts as facade for 'persisting' system, so it use an Helper that > invocates a series of DAOs. > If something goes wrong I would like to abort (rollback) transaction. > At moment I can see, this is done from container only when the EJB method > throws an Exception. > Can I do it in one of class used by EJB without relying on Exception > mechanism?! Hi, In order to rollback container managed transaction you must call "EJBContext.setRollbackOnly()" [or throw system exception like "EJBException"]. Naturally by calling "setRollbackOnly" you don't suddenly stop execution of "transactioned" method. Calling "setRollbackOnly" gives effect after complete of method and befor end of transaction. So, if your code will want to execute [time|resource] consuming tasks after you call setRollbackOnly you should such code precede by test with method "EJBContext.getRollbackOnly()" Greetings GT [BTW. I apologize for my English :] ========================================================================== TOPIC: question about chat system http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21d12a9867e90275 ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 9:45 am From: [EMAIL PROTECTED] (ThumbGenie) hi, i digged up an article from Merlin Hughes from JavaWorld.com about building an internet chat system. This is a nice article, i tested it on some local machine here at home and it works great, the server running on a port, and clients connecting to them. Although when I want to try the same remotely, so running the server version of the chat on a linux machine hosted by ev1servers.net, and using the chat client in my browser, and trying to connect nothing happens. I installed the sun's java software on the linux machine ( not the rpm version ) and installed it inside a home directory of a web domain. I start the server version with the java command. This is going good so far. But when I try to connect with my client, nothing happens, its just waiting. Could it be that my dedicated server does not allow connections coming in on TCP ports ? I hope anyone could give me a small hint. Thanks! Marcel ---------------------------------------------- Posted with NewsLeecher v2.0 Beta 5 * Binary Usenet Leeching Made Easy * http://www.newsleecher.com/?usenet ---------------------------------------------- ========================================================================== TOPIC: Node value in a DOM model http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6ad224790943b9f ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 9:56 am From: [EMAIL PROTECTED] (Cyril Vi?ville) I'm using a DOM model to create a XML file of usual connections. All is good but when i'm using the "getMachine" method, i always have textnode value to null for TEXT_NODE nodes. my XML file is something like that for 1 usual connection <?xml version="1.0" encoding="UTF-8" ?> - <connexion> - <machine> <adresse>Captain</adresse> <port>6445</port> <systeme>Linux</systeme> </machine> </connexion> My java code : import java.io.*; import org.w3c.dom.*; import javax.xml.parsers.*; import org.apache.xml.serialize.*; public class DOMParsing { private Document Doc; public DOMParsing() { try { File XMLFile = new File("connexions.xml"); DocumentBuilderFactory Factory = DocumentBuilderFactory.newInstance(); DocumentBuilder Builder = Factory.newDocumentBuilder(); if (! XMLFile.exists()) { Doc = Builder.newDocument(); Element RootElem = Doc.createElement("connexion"); Doc.appendChild(RootElem); } else { Doc = Builder.parse(XMLFile); XMLFile.delete(); fileModify(); } } catch (Exception ex) { System.out.println(ex.toString()); } } public void addMachine(String Address, String Port, String Systm) { Node RootElem = Doc.getFirstChild(); Element Elem = Doc.createElement("machine"); RootElem.appendChild(Elem); Element FirstElem = Doc.createElement("adresse"); FirstElem.appendChild(Doc.createTextNode(Address)); Elem.appendChild(FirstElem); Element SecondElem = Doc.createElement("port"); SecondElem.appendChild(Doc.createTextNode(Port)); Elem.appendChild(SecondElem); Element ThirdElem = Doc.createElement("systeme"); ThirdElem.appendChild(Doc.createTextNode(Systm)); Elem.appendChild(ThirdElem); fileModify(); } public void deleteMachine(int placement) { Element Machine = (Element) Doc.getElementsByTagName("machine").item(placement); Machine.getParentNode().removeChild(Machine); fileModify(); } public void getMachine(int placement) { Node Machine = Doc.getElementsByTagName("machine").item(placement); NodeList Nodes = Machine.getChildNodes(); for (int Number = 0; Number < Nodes.getLength(); Number++) { Node Child = Nodes.item(Number); if (Child.getNodeType() != Node.TEXT_NODE) { System.out.println("Mixed content! Skipping child element " + Child.getNodeName()); continue; } else { System.out.println("Hello " + Child.getNodeName()); } } } private void fileModify() { try { XMLSerializer XMLOut = new XMLSerializer(new FileWriter("connexions.xml"), new OutputFormat("xml", "UTF-8", true)); XMLOut.serialize(Doc); } catch (Exception ex) { System.out.println(ex.toString()); } } } ========================================================================== TOPIC: Two JFrames, one dialog http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b82885ddec2ae08d ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 9:58 am From: "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> "Lynx" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > My JFrame (main) creates new Jframe (second), this second creates modal > JDialog. But this modal JDialog is also modal with the main frame. > How to make JDialog modal only with the second frame ? Swing (and AWT) only support "application modal" dialogs. Per-frame modality is a long time RFE. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4080029 ========================================================================== TOPIC: Is instanceof dirty? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/395347a70489adef ========================================================================== == 1 of 1 == Date: Mon, Nov 8 2004 10:04 am From: DeMarcus <[EMAIL PROTECTED]> Hi, I come from the C++ world and there they say "no no" when you want to switch on type information. Even the inventor of C++ say so. What's the common opinion about using the java keyword instanceof? // Daniel ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
