comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * String replaceAll fails - 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bcb219b705c63680 * JTextArea question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b5070301a6779b * long class name problem - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54ffff98c385d2e8 * Help debugging medical education applet - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ddff3a15c4d8786e * Packing JRE - 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1a5c7579f5f09e2 * Which Compiler? - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaff02cdae418719 * How do I start up JBoss using ant? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e20ea52fd1c63536 * hi all - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca38bfbf0ac2dfb8 * getLocalHost Question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4c429df340243d0 ============================================================================== TOPIC: String replaceAll fails http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bcb219b705c63680 ============================================================================== == 1 of 5 == Date: Tues, Dec 21 2004 5:17 pm From: "Tim" // what's wrong with this code? public class TestReplaceAll { public static void main(String[] args) { String techName = "O'brien, Jones"; String replacement = "\\'"; System.out.println( techName.replaceAll("[']", replacement) ); System.out.println( techName.replaceAll("[']", "\'" ) ); System.out.println( techName.replaceAll("[']", "\\'" ) ); System.out.println( techName.replaceAll("[']", "\\''" ) ); } } // here's the output O'brien, Jones O'brien, Jones O'brien, Jones O''brien, Jones // And here's the documentation on the replaceAll function: replaceAll public String replaceAll(String regex, String replacement)Replaces each substring of this string that matches the given regular expression with the given replacement. An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result as the expression El bugaroo! TimJowers == 2 of 5 == Date: Tues, Dec 21 2004 8:24 pm From: "Josh Martin" > // what's wrong with this code? Looks like it's working fine to me - what did you expect as output? == 3 of 5 == Date: Wed, Dec 22 2004 1:24 am From: Andrew Thompson On 21 Dec 2004 17:17:42 -0800, Tim wrote: > // what's wrong with this code? > > public class TestReplaceAll { > > > public static void main(String[] args) { > > String techName = "O'brien, Jones"; > String replacement = "\\'"; techName = techName.replaceAll("[']", replacement); System.out.println( techName ); ... -- 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 == 4 of 5 == Date: Wed, Dec 22 2004 1:39 am From: Esmond Pitt Andrew Thompson wrote: > techName = techName.replaceAll("[']", replacement); > System.out.println( techName ); That's formally equivalent to what he did. == 5 of 5 == Date: Tues, Dec 21 2004 6:40 pm From: "Tim" The bug was mine/documentation. public String replaceAll(String regex,String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement. I assumed they meant "replacement [String]" but they meant "replacement [special set of characters]". Where the special set of characters is at least partially defined in the doc for the Matcher class and means you'll get unexpected behavior if the replacement String contains \ or $ and you did not realize the behavior is that of Matcher.replaceAll. The correct solution for me was techName = techName.replaceAll("[']", "\\\\'"); as I needed to change each ' to a \' for use as parameters to a javascript function. Maybe someone has written a RegEx class that uses methods and attributes rather than special characters to carry out its functions? Thanks for the feedback, TimJowers ============================================================================== TOPIC: JTextArea question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b5070301a6779b ============================================================================== == 1 of 1 == Date: Wed, Dec 22 2004 1:23 am From: "Sherman Wang via JavaKB.com" I have the same problem: 1. My code has a non-editable JTextArea. My computer is XP professional with SP2. I compile my code using JDK 1.3.2. 2. When I run it using JRE 1.3.2, I can select text and copy it. 3. But If I run it using JRE 1.4.1_07, JRE 1.4.2_06 and JRE 1.5.0, the text is not selectable anymore. Because I use the same code and the same classes, I think there is something dependent on JRE. -- Message posted via http://www.javakb.com ============================================================================== TOPIC: long class name problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54ffff98c385d2e8 ============================================================================== == 1 of 4 == Date: Wed, Dec 22 2004 3:02 am From: "T. Berger" Hi, I'm using JAXB and run into problems when executing generated classes from xjc: java.lang.NoClassDefFoundError: de/thorstenberger/uebman/xml/taskdef/complex/jaxb/impl/ComplexTaskDefTypeImpl$CategoryTypeImpl$ClozeTaskBlockTypeImpl$ClozeSubTaskDefTypeImpl$ClozeTypeImpl$GapTypeImpl$Unmarshaller The complete path of that class doesn't exceed 256 chars. It works fine under Windows, but under Linux (jdk 1.4.1) I get a NoClassDefFoundError, though the class is accessible by the filesystem. Does anyone know how to solve this? Thanks in advance, T. Berger == 2 of 4 == Date: Wed, Dec 22 2004 2:46 am From: "Tony Morris" "T. Berger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm using JAXB and run into problems when executing generated classes > from xjc: > java.lang.NoClassDefFoundError: > de/thorstenberger/uebman/xml/taskdef/complex/jaxb/impl/ComplexTaskDefTypeImp l$CategoryTypeImpl$ClozeTaskBlockTypeImpl$ClozeSubTaskDefTypeImpl$ClozeTypeI mpl$GapTypeImpl$Unmarshaller > > The complete path of that class doesn't exceed 256 chars. It works fine > under Windows, but under Linux (jdk 1.4.1) I get a NoClassDefFoundError, > though the class is accessible by the filesystem. > > Does anyone know how to solve this? > Thanks in advance, > T. Berger Nothing to do with the class name length and has everything to do with your environment. Provide more specific details about why the class cannot be found on your Linux system? > ECHO $CLASSPATH > java -version Are you passing anything on the classpath at VM invocation time? Note that the class: de/thorstenberger/uebman/xml/taskdef/complex/jaxb/impl/ComplexTaskDefTypeImp l$CategoryTypeImpl$ClozeTaskBlockTypeImpl$ClozeSubTaskDefTypeImpl$ClozeTypeI mpl$GapTypeImpl$Unmarshaller typically (definitely if class ComplexTaskDefTypeImpl is public) belongs in a file called ComplexTaskDefTypeImpl.java Also, there is no maximum length of a class name mandated by any of the relevant specifications. -- Tony Morris http://xdweb.net/~dibblego/ == 3 of 4 == Date: Wed, Dec 22 2004 3:16 am From: Andrew Thompson On Wed, 22 Dec 2004 02:46:20 GMT, Tony Morris wrote: > Also, there is no maximum length of a class name mandated by any of the > relevant specifications. Not even the maximum size of the class[1] file itself? [1] Around 64(?) Kb AFAIR. -- 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 == 4 of 4 == Date: Wed, Dec 22 2004 4:15 am From: "xarax" "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 22 Dec 2004 02:46:20 GMT, Tony Morris wrote: > > > Also, there is no maximum length of a class name mandated by any of the > > relevant specifications. > > Not even the maximum size of the class[1] file itself? > > [1] Around 64(?) Kb AFAIR. Also remember that Windows file system is case-insensitive, while Linux is case sensitive. It could be a simple error in the file name casing. ============================================================================== TOPIC: Help debugging medical education applet http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ddff3a15c4d8786e ============================================================================== == 1 of 2 == Date: Tues, Dec 21 2004 7:12 pm From: "Grog" Medical Educational Applet. Written some years ago - runs with some irritating bugs. May be veiwed at: http://www.acid-base.com/abdiag.ssi My debugged code compiles and executes perfectly on the Applet runner, but fails on several combinations of browser/platform. Development environment: Mac running OS 10.3.6 with current release of Xcode Is there a kind soul willing to assist this retired medical educator? Preferably one also blessed (cursed ?) with the same environment. Thanks, Grog == 2 of 2 == Date: Wed, Dec 22 2004 5:55 am From: Andrew Thompson On 21 Dec 2004 19:12:08 -0800, Grog wrote: > Medical Educational Applet. > Written some years ago - runs with some irritating bugs. Like what? > May be veiwed at: > http://www.acid-base.com/abdiag.ssi ..hmmm. OK. Saw no stacktraces in my console using WinXP for .. IE 6.0026 running JRE 1.5.0 IE 6.0026 " MSVM 1.1.4 NN 4.80 " Symantec 1.1.5 That is a wide range of VM's. From the first that I know that existed for a browser, through the current release. It also seemed to work logically as far as I understood it (which was 'not much') in all three cases. The upper part of the graph showed variants of 'blue/good' and the lower section displayed 'red/warning' with text appearing in the texarea with scrollbars as required. Did I miss something? (Lots?) > My debugged code compiles and executes perfectly on the Applet runner, > but fails on several combinations of browser/platform. Which ones? Please be specific about OS, browser (make and version) and Java (make and version) The last can be answered here.. <http://www.physci.org/pc/property.jsp?prop=java.version+java.vendor> > Development environment: > Mac running OS 10.3.6 with current release of Xcode Ughh.. I gave up on even *supporting* Macintoshes in any serious way when it turned out that Java for the Mac needs to be specially set-up and packaged to invoke 1.4 Java. > Is there a kind soul willing to assist this retired medical educator? ...hmmm. How much code is there in kilobytes? The reason I ask is that well meaning professionals[1] who write Java programs generally write absolutely terrible and hard to read code. I would be looking to get you to trim it down to the shortest compileable example[2] that displays the problem. And yes, you heard me right 'problem', singular. Solve one problem at a time. [1] I'm guessing that roughly describes you, you were in the medical field, but wrote this applet? [2] <http://www.physci.org/codes/sscce.jsp> > Preferably one also blessed (cursed ?) with the same environment. [ I suspect that is asking too much. Most Java developers seem to run Windows or Linux. ] -- 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: Packing JRE http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1a5c7579f5f09e2 ============================================================================== == 1 of 6 == Date: Wed, Dec 22 2004 3:19 am From: Bender Can anyone tell me how to package a JRE with my JAR application? Thanks == 2 of 6 == Date: Wed, Dec 22 2004 4:05 am From: Bender Andrew Thompson wrote: > On Wed, 22 Dec 2004 03:19:01 GMT, Bender wrote: > > >>Can anyone tell me how to package a JRE with my JAR application? > > > Why? How do you intend to deploy your application? > Off CD(1)? Off the net(2)? > > 1) you would simply include the latest JRE on the CD. > 2) you would point the user to Sun. > > But then there is the lesser followed route of creating a > not-cross platform '.exe' of your Jar file. > <http://www.physci.org/codes/javafaq.jsp#exe> > I am distributing it over the net. I was hoping to keep the user from downloading the JRE for a Windows version, i.e. - releasing an 'exe' version. == 3 of 6 == Date: Wed, Dec 22 2004 4:16 am From: Andrew Thompson On Wed, 22 Dec 2004 04:05:24 GMT, Bender wrote: ... > I am distributing it over the net. I was hoping to keep the user from > downloading the JRE Many people already have them (even Windows users). Even better, when a new, faster, better JRE becomes available (and is automatically updated on the client-side), your app. gains those benefits. >..for a Windows version, i.e. - releasing an 'exe' version. In that case, if you only require windows support, it makes more sense to develop it in .NET. OTOH, given the code is already written, the links from the document I mentioned earlier should give you an idea of your options. -- 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 == 4 of 6 == Date: Wed, Dec 22 2004 1:30 pm From: Son KwonNam Use Install Anywhere. It can make .exe for your application with/without JRE. http://www.zerog.com Bender wrote: > Can anyone tell me how to package a JRE with my JAR application? > > Thanks == 5 of 6 == Date: Wed, Dec 22 2004 2:10 pm From: "IINET" re: In that case, if you only require windows support, it makes more sense to develop it in .NET. Why - just becasue it is only for windows does not rule out java automatically? Why suddenly switch to a whole other platform becasue it is not intended for anything other than windows? Java runs on windows - so what if it runs many other places too? "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 22 Dec 2004 04:05:24 GMT, Bender wrote: > > ... >> I am distributing it over the net. I was hoping to keep the user from >> downloading the JRE > > Many people already have them (even Windows users). > > Even better, when a new, faster, better JRE becomes available > (and is automatically updated on the client-side), your app. > gains those benefits. > >>..for a Windows version, i.e. - releasing an 'exe' version. > > In that case, if you only require windows support, it makes > more sense to develop it in .NET. OTOH, given the code > is already written, the links from the document I mentioned > earlier should give you an idea of your options. > > -- > 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 == 6 of 6 == Date: Tues, Dec 21 2004 10:21 pm From: "Robert kebernet Cooper" Bender wrote: > Andrew Thompson wrote: > > On Wed, 22 Dec 2004 03:19:01 GMT, Bender wrote: > > > > > >>Can anyone tell me how to package a JRE with my JAR application? > > > > > > Why? How do you intend to deploy your application? > > Off CD(1)? Off the net(2)? > > > > 1) you would simply include the latest JRE on the CD. > > 2) you would point the user to Sun. > > > > But then there is the lesser followed route of creating a > > not-cross platform '.exe' of your Jar file. > > <http://www.physci.org/codes/javafaq.jsp#exe> > > > > I am distributing it over the net. I was hoping to keep the user from > downloading the JRE for a Windows version, i.e. - releasing an 'exe' > version. Honestly, I would recommend skipping the unified installer and use Java WebStart. It gives you all the advantages of a windows installer plus automatic updates. Plus, once a person has one JRE with WebStart installed, it will automatically update their JRE if you shift forward with your app too. ============================================================================== TOPIC: Which Compiler? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaff02cdae418719 ============================================================================== == 1 of 4 == Date: Wed, Dec 22 2004 3:44 am From: "Smitsky" > jikes from IBM research labs. Thanks Kartik. Have you ever used it? If using the JDK in a Windows environment, which editor would you recommend? Thanks again, Steve == 2 of 4 == Date: Wed, Dec 22 2004 4:06 am From: Andrew Thompson On Wed, 22 Dec 2004 03:44:30 GMT, Smitsky wrote: > If using the JDK in a Windows > environment, which editor would you recommend? TextPad. Of scourse, that advice might be different depending on the requirements you have not stated. Requirements such as.. What system/RAM do you have? Lots? Do you require autocomplete? Do you require integrated WAR deployment? Does this editor need to have an inbuilt debugger? ... -- 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 == 3 of 4 == Date: Wed, Dec 22 2004 4:26 am From: "Smitsky" Hi Andrew. > What system/RAM do you have? Lots? Windows XP / 512 MB > Do you require autocomplete? It would be nice. > Do you require integrated WAR deployment? I'm not familiar with this. > Does this editor need to have an inbuilt debugger? Would be nice too. Thanx, Steve == 4 of 4 == Date: Wed, Dec 22 2004 5:32 am From: Andrew Thompson On Wed, 22 Dec 2004 04:26:56 GMT, Smitsky wrote: > Hi Andrew. Generally personal greetings are discouraged, since you are not so much writing to me as writing to the 'eternal scroll'. Also, they have the tendecny to make people ..pause, before they reply, as I did when I went to answer your first reply. >> What system/RAM do you have? Lots? > > Windows XP / 512 MB I have the same, with an Athlon 1.8GHz CPU, and find some of the the standard recommended editors too slow. Especially Netbeans, but also Eclipse to a lesser extent. I have not had enough experience with JBuilder, Emacs or IntelliJ (other editors regularly recommended) to comment. >> Do you require autocomplete? > > It would be nice. > >> Do you require integrated WAR deployment? > > I'm not familiar with this. I was really fishing to find out if you had lots of arcane requirements for the editor. This tells me - no. >> Does this editor need to have an inbuilt debugger? > > Would be nice too. (shrugs) 'Would be nice' is not something I would consider a *requirement*, so I'll stick with my earlier advice - 'TextPad'. It is a lightweight editor with *none* of the above. It merely colors keywords (which I find preferable to autocomplete) and allows you to compile and run from within the editor. Others will almost certainly disagree with me. ;-) Now.. before I lose you attention, I am curious about one aspect of your original question. Why did you want a compiler that was *not* Sun's? -- 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: How do I start up JBoss using ant? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e20ea52fd1c63536 ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 11:18 pm From: Sudsy Michiel Konstapel wrote: > On Tue, 21 Dec 2004 16:35:34 -0500, Sudsy <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: <snip> >> You need to feed it an executable, not a batch file. Batch files cannot >> be invoked directly; you need some kind of command processor. On *UNIX >> systems it would be something like /bin/sh. It goes under various >> guises on M$ systems. > > > In the case of NT/2000/XP it's cmd.exe, for 9x/Me it's command.com. > Michiel Thanks kindly for the clarification. So hard to keep track of what they're calling it these days... To the OP: With this additional information we can suggest the following: NT: <exec command="cmd.exe run.bat" dir="${jboss.root.dir}\bin\" spawn="true" /> Win 98/ME: <exec command="command.com run.bat" dir="${jboss.root.dir}\bin\" spawn="true" /> Disclaimer: Above information is untested. YMMV. ============================================================================== TOPIC: hi all http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca38bfbf0ac2dfb8 ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 11:27 pm From: Sudsy akshatha wrote: > i am new to j2ee. i have been working with j2ee sun 1.4. Now, i want > to deploy my application in jboss. Kindly provide me sufficient > guidance Kindly provide me sufficient funds and I will be most happy to provide the guidance... ;-) ============================================================================== TOPIC: getLocalHost Question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4c429df340243d0 ============================================================================== == 1 of 1 == Date: Tues, Dec 21 2004 8:57 pm From: "Yamin" Okay, I was curious :) Here you go...this will get you your external IP. ************************************************************** //http://www.breakingpar.com/bkp/home.nsf/Doc?OpenNavigator&U=87256B280015193F87256E6E006E29CE package yRealIP; import java.io.*; import java.net.*; import java.util.*; public class GetHTML { private Vector result = new Vector(); // An array of each line of HTML private String userName = ""; private String password = ""; public void readHTML(String urlToRead) { URL url; // The URL to read HttpURLConnection conn; // The actual connection to the web page BufferedReader rd; // Used to read results from the web page String line; // An individual line of the web page HTML try { url = new URL(urlToRead); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); if ( (userName.equals("") == false) && (password.equals("") == false) ) { String userPwd = userName + ":" + password; String encoding = new sun.misc.BASE64Encoder().encode(userPwd.getBytes()); conn.setRequestProperty("Authorization", "Basic " + encoding); } rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = rd.readLine()) != null) { result.addElement(line); } rd.close(); } catch (Exception e) { e.printStackTrace(); } } public int numLines() { return result.size(); } public String getHTML(int pos) { if (pos < result.size()) { return (String)result.elementAt(pos); } else { return ""; } } public void setUserNameAndPassword(String u, String p) { userName = u; password = p; } } ************************************************************ package yRealIP; import java.util.StringTokenizer; public class getExtIP { static String HTML_PAGE = "http://www.whatismyip.com"; static String CHECK_LINE = "Your ip is"; public getExtIP() { } public String getExternalIP() { String result = null; GetHTML page = new GetHTML(); page.readHTML(HTML_PAGE); int numLines = page.numLines(); //we could do this the easy/cheap way or a better way //i will just do it the cheap way :) for(int i=0; i < numLines; i++) { String line = page.getHTML(i); int ipPos = line.indexOf(CHECK_LINE); if( ipPos < 0) continue; String restOfLine = line.substring(ipPos + CHECK_LINE.length()); StringTokenizer st = new StringTokenizer(restOfLine); while (st.hasMoreTokens()) { String ip = st.nextToken(); result = ip; break; } } return result; } public static void main(String[] args) { getExtIP test = new getExtIP(); String res = test.getExternalIP(); System.out.println("IP Address is: "+ res); } } ************************************************************** ============================================================================== 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
