|
TRex EaterofCars posted:I actually do not know how Jaskell is implemented. I kinda wrote that post quickly and should have put the word "also" in there somewhere. :p
|
# ? Apr 30, 2008 20:41 |
|
|
# ? May 8, 2024 05:26 |
|
zootm posted:Sorry I don't want to seem like I'm digging in at you, I'm just interested! Heh, it's cool. Jaskell is open source, you can always take a look I've honsetly spent most of my "programmer education time" following Groovy, since it interfaces so well with Java. And learning Haskell as well as I can, but that's a bit off-topic.
|
# ? Apr 30, 2008 21:27 |
|
I really need to decompile some of my old code that I stupidly did not back up. I did not obfuscate (I think that is the word), to my knowledge. I compiled in Netbeans 5.x and it was compiled using java 1.4.x I'm trying DJ and it is ok, but am wondering if there is anything better (commercial options are fine too). Thanks in advance!!
|
# ? May 1, 2008 04:34 |
|
I've had decent results using Cavaj.
|
# ? May 1, 2008 05:31 |
|
If I'm reading something from an InputStream using BufferedReader is there a way to make it only wait for a response a set amount of time? If not is there any other way to read from an InputStream where I could do this? I have a kind of a simple client server type thing with socket and serversocket going on and I'm at a point where the server asks all of the client a question at the same time. After this it analyzes their responses and if any of the clients fails to respond to the message then the server hangs up and thus screws everything up for all of the other clients. The only way to solve this that I know of is to make a new thread for every message I send out, but there has to be a better way than that. EDIT: Nevermind, found the ready() method in bufferedreader MaxxBot fucked around with this message at 01:26 on May 2, 2008 |
# ? May 1, 2008 22:57 |
|
How do I save an XML document I created with org.w3c.dom.Document to a file?
|
# ? May 2, 2008 19:00 |
|
I'm reading up on design patterns and I saw this interface declaration: public interface DrawingView extends ImageObserver, DrawingChangeListener {...stuff...} I thought java doesn't support multiple inheritance?... By the way, DrawingChangeListener is another interface. so interface extends another_interface doesn't really count as inheritance or what?
|
# ? May 2, 2008 19:54 |
|
CrusaderSean posted:I'm reading up on design patterns and I saw this interface declaration: It doesn't for classes, but an interface can extend (and a class can implement) multiple base interfaces.
|
# ? May 2, 2008 19:55 |
|
csammis posted:It doesn't for classes, but an interface can extend (and a class can implement) multiple base interfaces. Ah, k. That makes sense.
|
# ? May 2, 2008 19:57 |
|
Fehler posted:How do I save an XML document I created with org.w3c.dom.Document to a file? Flying somewhat blind: code:
|
# ? May 2, 2008 19:57 |
|
zootm posted:Flying somewhat blind: The JAXP tutorial has the following example: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html
|
# ? May 3, 2008 10:26 |
|
JingleBells posted:The JAXP tutorial has the following example: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html I guess it's worth noting that that does require JAXP, which isn't standard in Java until I think Java 5 or 6. zootm fucked around with this message at 12:21 on May 3, 2008 |
# ? May 3, 2008 12:16 |
|
Looks like it works, thanks! I guess something like doc.save(path) would have been too easy...
|
# ? May 3, 2008 13:20 |
|
Fehler posted:Looks like it works, thanks! I guess something like doc.save(path) would have been too easy...
|
# ? May 3, 2008 14:39 |
|
I am working on my AI homework (which I knew I shouldn't be doing in Java), but nonetheless, I ran into a problem that has challenged my understanding of object passing in Java. This question is in the context of the Eclipse IDE. I have a State class. I have an ArrayList named stateSpace that contains all of the states in the problem. I am now thinking I should change this to a map, but whatever. My problem is that each of these States also contain their own ArrayList of states named transitions which contain the 8 possible states they could transition to based on an action. Here's the problem: When I go about setting these transitions, I search my stateSpace array for an appropriate state and add it to the given state's transition array. However, in the Eclipse debugger, I'm looking at the same state in both the stateSpace list and a transitions list that contains it. They both have the same Eclipse debugger id number (which implies to me they are a pointer to the same object). However, the one in the stateSpace lists all of the appropriate fields it should have, while the one in transitions only has one and is missing a ton of information. What is going on? Is there something fundamnetally wrong with adding a state to a list, then modifying that state in a different context and expecting it to be changed in the list?
|
# ? May 4, 2008 22:48 |
|
It sounds like what you're doing is valid. Try highlighting the variable that isn't getting updated right and pressing ctrl+shift+I and see if it gives you a more up to date picture. You could also try showing the Display view and writing a line of code to access one of the members in question and then hit the run button or highlight + ctrl+shift+I.
|
# ? May 5, 2008 00:06 |
|
poopiehead posted:It sounds like what you're doing is valid. Try highlighting the variable that isn't getting updated right and pressing ctrl+shift+I and see if it gives you a more up to date picture. You could also try showing the Display view and writing a line of code to access one of the members in question and then hit the run button or highlight + ctrl+shift+I. Thanks, I think you're right, Java wasn't the problem, Eclipse just arbitrary decided to give me less information then was there.
|
# ? May 5, 2008 01:18 |
|
I'm making a Java app, in NetBeans, that uses a library in a .jar file (JYaml if it's important). I want to package this library with the project, so that the project can be moved around and compiled and run on anywhere on any computer. After quite a bit of searching and screwing around with NetBeans, it seems that NetBeans doesn't really have any way of referencing a relative path to a library. I've managed to get it to work anyways by putting the .jar file in my /src directory and editing the project's project.properties file to include the line code:
What I think happens is that it looks for the library in the absolute path, doesn't find it, shows the error message, and then my relative path in project.properties gets substituted in, the library is accessible now, but NetBeans doesn't get rid of the error message because it's "Resolve Reference Problem" button wasn't clicked. Any way to fix this properly?
|
# ? May 7, 2008 20:44 |
|
Did you remove the absolute path link to the library in question? That could cause it problems. I've certainly gotten relative paths to work fine without error markers many times before so it's not something that can't be fixed.
|
# ? May 8, 2008 00:26 |
|
That's the thing, NetBeans doesn't let me just type a path, or use any other way of setting a relative path. When I try to add a library classpath, I always get a "Select a folder" dialogue box, which always returns an absolute path.
|
# ? May 8, 2008 05:31 |
|
Is there an easy way to put breakpoints on Java library functions? Let's say I want to put a breakpoint on one of the constructors of java.io.File. IDE is Eclipse but I'm willing to switch to any IDE for this.
|
# ? May 8, 2008 19:41 |
|
Alan Greenspan posted:Is there an easy way to put breakpoints on Java library functions? Let's say I want to put a breakpoint on one of the constructors of java.io.File. Yeah, in Eclipse your java source should already be linked to the rt.jar file. Just ctrl+click on a new File() statement and it'll take you right to the constructor. If that doesn't work, you probably have to link the source. I can tell you how to do that if you need.
|
# ? May 8, 2008 20:44 |
|
TRex EaterofCars posted:Yeah, in Eclipse your java source should already be linked to the rt.jar file. Just ctrl+click on a new File() statement and it'll take you right to the constructor. If that doesn't work, you probably have to link the source. I can tell you how to do that if you need. Thanks for the reply but apparently this is tricky because when I set a breakpoint into the rt.jar source ...
|
# ? May 8, 2008 20:54 |
|
Alan Greenspan posted:Thanks for the reply but apparently this is tricky because when I set a breakpoint into the rt.jar source ... What versions of Eclipse and Java are you running?
|
# ? May 8, 2008 20:58 |
|
What's the deal with loading images from the web to display in applets? I'm following the directions from this site, but whenever I try to compile, I'm told that the method "getImage()" doesn't exist. I'm doing this within a file that is a smaller class used in the Applet, not the Applet class itself, so could that be the problem? Pretty much the entire program is finished except for this (I was previously working offline as an application, and therefore just using a toolKit) so I'm not willing to move the loading of graphics into the Applet class, unless that's the only way. Ideas? (Just for clarification, here is exactly how I'm trying to implement this: code:
|
# ? May 8, 2008 21:02 |
|
TRex EaterofCars posted:What versions of Eclipse and Java are you running? I figured it out. I was using the rt.jar from the real JRE, using the rt.jar from the JRE shipped with the JDK worked. Thank you.
|
# ? May 8, 2008 21:23 |
|
Emo.fm posted:What's the deal with loading images from the web to display in applets? I'm following the directions from this site, but whenever I try to compile, I'm told that the method "getImage()" doesn't exist. You answered your own question, there. Your code attempts to call a method called getImage() in your small class that is used in the Applet class. If you haven't written a method like that, then it is not going to work. Call the Applet class' getImage() method instead.
|
# ? May 8, 2008 21:55 |
|
ynef posted:You answered your own question, there. Your code attempts to call a method called getImage() in your small class that is used in the Applet class. If you haven't written a method like that, then it is not going to work. Call the Applet class' getImage() method instead. Sorry, I'm still a little confused. Let's say I have two files, MyApplet.java and SmallClass.java. If I want to load an image in SmallClass.java, how do I do it? Moving all of the image related operations that occur in SmallClass to MyApplet is not an option for me right now. There must be some way to load an image in a class that isn't an applet, right? PS - If what you meant was to call Image myImage = MyApplet.getImage("url"); that doesn't seem to work either.
|
# ? May 8, 2008 22:50 |
|
Emo.fm posted:Sorry, I'm still a little confused. Let's say I have two files, MyApplet.java and SmallClass.java. If I want to load an image in SmallClass.java, how do I do it? Moving all of the image related operations that occur in SmallClass to MyApplet is not an option for me right now. There must be some way to load an image in a class that isn't an applet, right?
|
# ? May 8, 2008 22:57 |
|
Stupid question. I have literally tried everything too solve this, including rewriting the classes in question, but no luck. I have a class with some methods which queries a database and returns the result set as an arraylist of strings. And in my gui-class I try to populate some comboboxes with the arraylists. Since swing apparently can't use arraylists I have tried to convert the arraylists to vectors with no luck, and arrays of strings, with no luck. I have even tried to get the methods to return Vectors. No matter what I do I get nullpointerexception-error. database-class: code:
code:
code:
|
# ? May 9, 2008 00:51 |
|
Thlom posted:After some investigation it seems like the nullpointerexceptions gets thrown at Looks like you may have a connection problem. The rest of the implementation looks like it would work. Check if con == null, and if it is, then you were never connected in the first place, so that's what you should focus on at this point.
|
# ? May 9, 2008 01:06 |
|
epswing posted:Looks like you may have a connection problem. The rest of the implementation looks like it would work. Check if con == null, and if it is, then you were never connected in the first place, so that's what you should focus on at this point.
|
# ? May 9, 2008 01:25 |
|
Well the docs say "SQLException - if a database access error occurs". They don't say whether "access error" means there was an error with your login information (permission problem), or if there was an error communicating with the database. In any case, a NPE occurring at a line with obj.methodCall() means obj was null.
|
# ? May 9, 2008 03:47 |
|
epswing posted:Well the docs say "SQLException - if a database access error occurs". They don't say whether "access error" means there was an error with your login information (permission problem), or if there was an error communicating with the database.
|
# ? May 9, 2008 21:01 |
|
Thlom posted:Sorry for wasting your time, I will go and throw my self out of the window now. Just make sure you haven't dispose()d your Graphics2D context first.
|
# ? May 9, 2008 22:38 |
|
Emo.fm posted:PS - If what you meant was to call Image myImage = MyApplet.getImage("url"); that doesn't seem to work either. No, that doesn't work because getImage() is not a static method. Do you have a reference to an object of MyApplet? If so, you should be able to call the method that way. Either way, I think you should review your textbook again concerning references and method calls.
|
# ? May 10, 2008 15:04 |
|
I am running a third party command line based application through a Runtime call. This is using Java1.4. Essentially I have: Process p = Runtime.getRuntime().exec("cmd.exe /c "+thirdPartyCommand); The command takes about 2 seconds to run but in order to complete the command, it prompts you with a yes or no question. I always, programmatically, want to answer "y", but how do I pass that to the single Runtime command? To clarify, currently I am running this third party application but want to serve the application to my users through a servlet. So I figured I would just use a Runtime system call, but I forgot about the yes/no prompt that needs to be answered in order for the application to finish. Thanks in advance!!
|
# ? May 14, 2008 04:32 |
|
mister_gosh posted:I am running a third party command line based application through a Runtime call. This is using Java1.4. Essentially I have: Just call p.getOutputStream() (keeping in mind that the OutputStream is really the InputStream for the other process) and then wrap the Stream you get in a BufferedWriter or whatever and then send a 'y' through that. Then you can wait for it to finish with p.waitFor which returns the exit value of the terminated process.
|
# ? May 14, 2008 04:42 |
|
1337JiveTurkey posted:Just call p.getOutputStream() (keeping in mind that the OutputStream is really the InputStream for the other process) and then wrap the Stream you get in a BufferedWriter or whatever and then send a 'y' through that. Then you can wait for it to finish with p.waitFor which returns the exit value of the terminated process. Thanks! Works great
|
# ? May 14, 2008 05:14 |
|
|
# ? May 8, 2024 05:26 |
|
Howdy, if I have some Class<?> object (in my case, returned from a Field#getType() during reflection), how can I tell if the class represented by this object implements a particular interface or class? I guess this is the equivalent to the instanceof operator, except for the class type and not an object. e.g.: code:
code:
|
# ? May 14, 2008 16:53 |