|
The Bill posted:I think javadoc has a -private option (or something along those lines). Yea I use that, but it still doesn't seem to get inner private classes. I just changed them to public, problem solved. Not an elegant solution thou
|
# ? Jan 9, 2009 22:52 |
|
|
# ? Apr 27, 2024 16:44 |
|
hexadecimal posted:Yea I use that, but it still doesn't seem to get inner private classes. I just changed them to public, problem solved. Not an elegant solution thou
|
# ? Jan 10, 2009 02:13 |
|
Is it possible to pass remote reference to the webservice using SOAP and axis2, then have java program running as webservice invoke methods on the client?
|
# ? Jan 10, 2009 09:32 |
|
hexadecimal posted:Is it possible to pass remote reference to the webservice using SOAP and axis2, then have java program running as webservice invoke methods on the client?
|
# ? Jan 10, 2009 14:34 |
|
zootm posted:I'm not sure what you're asking here, but I think that the answer is no, at least not directly. In SOAP the client invokes methods on the server which can just send responses. Of course you could send a response which should be interpreted as taking an action but there's almost definitely a better way to do this. Sorry if this is stupid or completely noobish, I have very limited experience with RMI, but would it be possible to somehow serialize a remote reference to an object that is running on client's computer, and send it in HTTPRequest to the webservice? Then have the Java program running as webservice store that reference and subsequently use RMI to invoke methods on the client's object? So I guess what this really is, is using webservice to setup RMI communication between server and client objects. If I am running RMI Registry on the same computer that run's webservice, would there be a way to do it that way also? That is, have the webservice return remote reference to the server side object to the client, and set up RMI that way?
|
# ? Jan 10, 2009 23:19 |
|
hexadecimal posted:I have some bugs in my webservice, that are probably threading related. However when it becomes unresponsive it blocks all other webservices. How can I make sure that my buggy webservice doesn't make other webservices and axis2 cry, besides the obvious "fix the bugs in the program"? hexadecimal posted:Stuff about RMI, SOAP, and HTTPRequests in Java On the other hand, what you're looking for has been done before, but the whole thing kinda makes me want to scream obscenities at all the useless compliance guys and standards-for-the-sake-of-standards attitude prevalent in so many organizations.
|
# ? Jan 11, 2009 01:12 |
What's an easy way to encode html entities with java?
|
|
# ? Jan 12, 2009 19:26 |
|
fletcher posted:What's an easy way to encode html entities with java? Apache Common's StringEscapceUtils. http://commons.apache.org/lang/
|
# ? Jan 12, 2009 20:14 |
|
Ok this might way too simple or really hard, but i can't think of a solution. I'm writing a simple networked paint program. Users in my program connect to each other through a socket and are displayed a clear white BufferedImage acting as a canvas. When they drag the mouse across the canvas, mouse events are turned into paths which are drawn on the panel and sent over to the other user as strings. These are simply parsed and drawn on that user's screen. My issue is with implementing transparency on the strokes. Because each minor segment is drawn individually – making it look like it updates quickly – lots of these overlap giving an inconsistent transparency. I did a mockup in Fireworks because these overlaps show up much more frequently in the program and the problem isn't as clear: This example is more or less what I get if I draw the paths with a stroke with cap_round, but all the other modes give me similar problems. My current version of the program (without transparency) is here if you'd like to test it: http://exegersis.com/apps/ Multiple pages haven't been fully implemented yet.
|
# ? Jan 13, 2009 14:29 |
|
I'd like to ask what is potentially a mind-bendingly stupid question, but it's driving me crazy. I'm a scientist, and I'm working with a guy who has written a piece of java software. It has a GUI, but I'm supposed to be using some super-secret poo poo that's not available from the GUI yet, invoking it from the command line. All I have is a jar file. He says I should be able to type: java stuff.Things -arguments And wonderful things should happen to me and my family. That is not happening. I get java.lang.NoClassDefFoundError: stuff/Things every time. I have never had to use a jar file this way before, and I'm guessing that I'm missing something really simple. I've googled it (honest!) but all I've found so far are a bunch of pages for java programmers outlining how to catch and use command line arguments.
|
# ? Jan 15, 2009 03:05 |
|
Trig Discipline posted:I'd like to ask what is potentially a mind-bendingly stupid question, but it's driving me crazy. I'm a scientist, and I'm working with a guy who has written a piece of java software. It has a GUI, but I'm supposed to be using some super-secret poo poo that's not available from the GUI yet, invoking it from the command line. All I have is a jar file. He says I should be able to type: You are probably not including some required library in the classpath: http://en.wikipedia.org/wiki/Classpath_(Java)
|
# ? Jan 15, 2009 03:21 |
|
Trig Discipline posted:All I have is a jar file. He says I should be able to type: code:
|
# ? Jan 15, 2009 03:24 |
|
Oh sweet jesus THANK you!
|
# ? Jan 15, 2009 03:43 |
|
I'm coding to the Lego NXT via lejos, and I have a server app on a pc which needs to make use of bluetooth in order to communicate with my nxt's. For this I use a lejos bluetooth wrapper of sorts perfectly suited for the nxt's running lejos. Now when I try to connect to an nxt through this I get the runtime error "Exception in thread "main" java.lang.NoSuchMethodError: javax.bluetooth.RemoteDevice.<init>(Ljava/lang/String;)V" and a big rear end call stack. This is of course because lejos in turn use the standard java bluetooth library, but the method shouldn't be missing since I have bluecove.jar in my classpath.
|
# ? Jan 18, 2009 14:58 |
|
Jarl posted:I'm coding to the Lego NXT via lejos, and I have a server app on a pc which needs to make use of bluetooth in order to communicate with my nxt's. One of the annoying things about classpaths is that you have to specify the full path to jars, including file name, not just the directory it's in. So the classpath should be something like c:\blah\blah\otherstuff.jar;c:\blah\blah\bluecove.jar rather than just c:\blah\blah What OS are you on, anyway? What is your full classpath? Edit: This page is helpful: http://mindprod.com/jgloss/classpath.html#GOTCHAS Edit x2: As this link points out, if your application itself is running from a .jar, Java silently ignores the classpath. You have to add the library jars to your manifest rather than the command-line classpath. Mill Town fucked around with this message at 15:34 on Jan 18, 2009 |
# ? Jan 18, 2009 15:30 |
|
My OS is Vista. MY IDE is Eclipse. In my eclipse project I have the same jar's as with the environment variable CLASSPATH ".;%Documents%\Eclipse\Lego\bin;%Program Files%\leJOS NXJ\lib\classes.jar;%Program Files%\leJOS NXJ\lib\jtools.jar;%Program Files%\leJOS NXJ\lib\pccomm.jar;%Program Files%\leJOS NXJ\lib\pctools.jar;%Program Files%\leJOS NXJ\3rdparty\lib\bcel-5.1.jar;%Program Files%\leJOS NXJ\3rdparty\lib\bluecove.jar;%Program Files%\leJOS NXJ\3rdparty\lib\commons-cli-1.0.jar;%Program Files%\leJOS NXJ\3rdparty\lib\cpptasks.jar" I'm not running from a jar - although I didn't know that could cause problems.
|
# ? Jan 18, 2009 15:54 |
|
Jarl posted:My OS is Vista. Classpath looks good. Go to the command line and do dir %Program Files%\leJOS NXJ\3rdparty\lib\bluecove.jar and make sure it's really there. Also, can you post the code that's giving the error? Edit: Also, what's the exact command you are using to run this from the command line (or are you running it from inside the IDE?) Does running inside the IDE work or do they both throw this exception? Edit x2: What's the output of java -version? Mill Town fucked around with this message at 18:23 on Jan 18, 2009 |
# ? Jan 18, 2009 18:17 |
|
I just found out it's because I include classes.jar in the project, which I'm not supposed to do. That jar is only for the programs running on the nxt, and not the programs running on the pc communicating with it. Thanks for your help though.
|
# ? Jan 19, 2009 11:58 |
|
Jarl posted:I just found out it's because I include classes.jar in the project, which I'm not supposed to do. That jar is only for the programs running on the nxt, and not the programs running on the pc communicating with it. That should only be a problem if they somehow contain different versions of the same class or the compiled version number is wrong for the system its running on.
|
# ? Jan 19, 2009 20:40 |
|
Gbanfalvi posted:Err yeah, no one answered my question. Though i found a pretty ugly solution that solves it, i was wondering if it was because it wasn't clear, it was retarded, or... ? This is just because I might ask questions in the future, and having some form of response might be cool then.
|
# ? Jan 21, 2009 19:07 |
|
Gbanfalvi posted:Err yeah, no one answered my question. Though i found a pretty ugly solution that solves it, i was wondering if it was because it wasn't clear, it was retarded, or... ? I didn't have any useful suggestions. The obvious problem was that you were drawing multiple translucent objects on top of each other. The obvious solution is to combine the objects instead of painting them separately, but I didn't have a good suggestion for how to do that while not causing excessive flicker on large objects, and I figured someone else here might have done it before. I mean, once you've got a single shared shape, there are three things you should try. First, you might want some sort of point-culling algorithm to eliminate unnecessary segments — if you're actually adding a point per mouse event, that can add up to a lot of redundant points. Second, you should investigate how to request redraw of only the affected region of the path, not the entire thing. Third, you might want to batch redraw requests to some manageable frequency — not one per mouse event, say.
|
# ? Jan 21, 2009 20:45 |
|
Gbanfalvi posted:Err yeah, no one answered my question. Though i found a pretty ugly solution that solves it, i was wondering if it was because it wasn't clear, it was retarded, or... ? Take a look at the setComposite() method of the Graphics2D object. This page is pretty helpful: http://java.sun.com/docs/books/tutorial/2d/advanced/compositing.html Specifically, take a look at the "Destination-Over" mode. When you draw pixel on a Graphics2D object, normally you expect your pixels to overlap whatever already exists on the surface. Using this Composite class, you can change this behavior. With the "Destination-Over" composite mode, when you draw on the surface, new pixels will only show up where no previous pixels existed. This should keep you from drawing pixels that overlap the previous stuff, making the color darker. Outlaw Programmer fucked around with this message at 01:28 on Jan 22, 2009 |
# ? Jan 22, 2009 01:20 |
|
I'm really new to Java, and am learning it for a CS class. I installed the Java SDK on my home computer, and whenever I try to run my compiled code through the command prompt I get an error message that says "Exception in thread "main" java.lang.NoClassDefFoundError" I looked this up and tried some solutions about editing my CLASSPATH in system settings, but I still haven't been able to get it work. Any help would be much appreciated!
|
# ? Jan 22, 2009 21:56 |
|
Jmcrofts posted:I'm really new to Java, and am learning it for a CS class. I installed the Java SDK on my home computer, and whenever I try to run my compiled code through the command prompt I get an error message that says Going to need more info like what command are you running to compile? javac MyClass.java ? Are you using packages or any external libraries?
|
# ? Jan 22, 2009 22:01 |
|
Jmcrofts posted:I'm really new to Java, and am learning it for a CS class. I installed the Java SDK on my home computer, and whenever I try to run my compiled code through the command prompt I get an error message that says What you're probably doing is that you type "java MyClass.class", when you should type "java MyClass" (without the ".class" suffix). This of course assumes that you follow your tutorial precisely and have a method like "public static void main(String[] args)", which you may consider the "entry point" of a program.
|
# ? Jan 22, 2009 22:06 |
|
ynef posted:What you're probably doing is that you type "java MyClass.class", when you should type "java MyClass" (without the ".class" suffix). This of course assumes that you follow your tutorial precisely and have a method like "public static void main(String[] args)", which you may consider the "entry point" of a program. This was pretty much my problem. Or rather, I guess I was trying to run the source code file rather than the compiled class file, which in retrospect was pretty stupid of me. Thanks for the help!
|
# ? Jan 22, 2009 22:49 |
|
Well, this is really embarassing but I can not find any logical answer to my problem in my textbook, nor google. I don't think I so much have a problem with code, as I do with the setup of my program. I' only 3 days into Java, so please, excuse the noobishness of this question, we all gotta start some where, right? Anyway, I'm using Netbeans to write and compile code but on multiple occasions I've had the program flag me when compiling for not having a main class set. As far as I can tell, I have one. I honestly am a little confused on the setup of Java programs and classes when starting a project. Here's the tiny program I am currently working on that will not compile because there is no main class.code:
Citanu541 fucked around with this message at 22:37 on Jan 23, 2009 |
# ? Jan 23, 2009 22:26 |
|
Citanu541 posted:Well, this is really embarassing but I can not find any logical answer to my problem in my textbook, nor google. I don't think I so much have a problem with You have several problems with the code. The method call getContentPane() is in JApplet not Applet so instead of "extends Applet" it should be "extends JApplet" JApplet is part of Swing, Applet is part of awt. Next you have "JLabel greeting = new Label("Who are you?");" Notice that your types are mismatched. Either make them both JLable or Lable. Last issue is that your constructor for the Font object is wrong. Look here for the correct constructors http://java.sun.com/javase/6/docs/api/java/awt/Font.html About the main class problem, you don't need one when making an applet or JFrame or whatever. I don't use netbeans so I'm not sure how it is there but in Eclipse they give you the option of "Run as applet" instead of "Run as application." Bellow is probally what you wanted your code to look like code:
lamentable dustman fucked around with this message at 23:00 on Jan 23, 2009 |
# ? Jan 23, 2009 22:56 |
|
Ah, thank you. I started debugging the obvious, but still ran into the no main class problem. I didn't realize all my syntax errors before posting that, but as I said, I didn't think the code was the problem. When every inch of the code is underlined in red, you start to feel the problem is else where. I appreciate you going over my code, however, plugging it into my current project, it STILL errors out with the class error. I hate this crap, I don't know what I'm not picking up, this is my second attempt at Java, but this is the exact same problem that plagued and stopped me last time.
|
# ? Jan 23, 2009 23:02 |
|
Citanu541 posted:Ah, thank you. I started debugging the obvious, but still ran into the no main class problem. I didn't realize all my syntax errors before posting that, but as I said, I didn't think the code was the problem. When every inch of the code is underlined in red, you start to feel the problem is else where. I launched NetBeans and had a look. When you create a project in NetBeans it makes a 'Main.java' class. You should probably just delete that. In the right click on the java file in the left pane (or hit shift+F6) you have the option to run the code. It launches just fine in the applet viewer.
|
# ? Jan 23, 2009 23:14 |
|
Dammit. Well, every project I create, even with the simplest bit of code runs as <no main classes found> I don't get it, I'm not as inept as this is making me out to be. This is making me more frustrated than anything, best to give up for now. Thank you for your help, though. e: I'm guessing I got a bunk instillation, because Netbeans never compiled anything correctly. Citanu541 fucked around with this message at 00:04 on Jan 24, 2009 |
# ? Jan 23, 2009 23:58 |
|
Citanu541 posted:Dammit. Well, every project I create, even with the simplest bit of code runs as <no main classes found> Just tested in my version of Netbeans (6.1 I believe), and I think I see what's going on. A "main" class is a class that can be used as a starting point for a program. This means the class either has a "public static void main(String[] args)" method OR, for applets, a "public void init()" method. However, it seems that Netbeans is only flagging classes that have the main() method, not the init() method. That means that you can't just click the "Run Project" button (defaults to F6 key I think). You CAN still run your applet. When you have YourApplet.java open, right click anywhere in the editor and click the "Run YourApplet.java" item. Alternatively, you can just press Shift-F6.
|
# ? Jan 24, 2009 04:06 |
|
Ha! That was exactly the problem, so it was the IDE. I think I'm starting to prefer Eclipse, but class requires NetBeans. That's really odd, though, how were we supposed to know that? (We've not created Applets except for this first assignment.) Thanks for the help, guys.
|
# ? Jan 24, 2009 08:02 |
|
Hey Guys, I am new to java (some experience with C) and I am having trouble coming up with a solution. I have a program that reads in scores to find the lowest highest and average score. What I need is for it to only accept numbers 1-100 into the array, any others will need to display "Invalid, try again" . I am currently trying a catch for Input mismatch, which works, but it ends the program instead of getting a new input Any ideas?code:
|
# ? Jan 26, 2009 15:28 |
|
The most obvious problem is that you don't close the catch block after the println(). A few points: Scanner is for parsing out more complex files for just the data you're interested in. You'd probably just want System.getConsole() to get the console for this program or use a BufferedReader created from the System.in input stream. Integer.parseInt() can parse any input string to tell if it's an integer. Typically you'd put a try-catch block around that and catch any NumberFormatExceptions. For situations where you don't know how many inputs you're going to have, an ArrayList<Integer> is usually cleaner. It uses auto-boxing to act like the ArrayList<Integer> really is an int[]. Finally, using -1 as a sentinel value is more trouble than it's worth when you can read in and recognize "q", "quit", "exit" or whatever.
|
# ? Jan 26, 2009 16:22 |
|
Fake Edit: Or just do what 1337JiveTurkey says. Though you did close the catch block, it just didn't look like it because the indentation was messed up.cyberburrito posted:looping stuff Also, I think it would make more sense to put the rest of the logic inside the try block, because otherwise you catch the exception and then keep going inside the loop as if everything were alright, which it isn't. And this isn't a java issue, but I'd put the increment of n at the end of the loop. Otherwise, every time someone tries a bad input, you skip a number, which I assume is not desired. So, 'my' code would look like code:
|
# ? Jan 26, 2009 16:34 |
|
I'm having an issue with having javascript communicating with a java applet I'm writing. The poo poo was working fine 3 weeks ago and apparently I've changed some things to break. I got the code cut down to bellow to test.code:
code:
In the full applet this updates a map which flashes for a split second before going back to the initial state like this example is showing. Any ideas why this is happening? It was working fine before.
|
# ? Jan 26, 2009 18:48 |
|
gently caress, just realized it is because I'm using a form tag and that is causing the whole page to reload. Took it out and it worked properly..... I had to remake the page after my workstation was reloaded and I forgot to back up that part.... that loving poo poo cost me over 6 hours of time....
|
# ? Jan 26, 2009 19:10 |
|
So has anyone else messed around with dependency injection frameworks / libraries in Java? Google Guice seems to be fine for the jobs we've got, but we've got ourselves a home-brew dependency injection framework that is extremely clunky and I'm trying to get a better grasp on other options before overhauling the clunkiness we've got. I'm trying to keep it simple, but I do know I'm going to have to write a code generator to use any framework since what I'm working with is generated code that would take basically forever to perform the bindings manually. There aren't any dependency injectors that load class files and generate code for found classes according to some rules by chance, are there?
|
# ? Jan 28, 2009 23:52 |
|
|
# ? Apr 27, 2024 16:44 |
|
necrobobsledder posted:So has anyone else messed around with dependency injection frameworks / libraries in Java? Google Guice seems to be fine for the jobs we've got, but we've got ourselves a home-brew dependency injection framework that is extremely clunky and I'm trying to get a better grasp on other options before overhauling the clunkiness we've got. I'm trying to keep it simple, but I do know I'm going to have to write a code generator to use any framework since what I'm working with is generated code that would take basically forever to perform the bindings manually. There aren't any dependency injectors that load class files and generate code for found classes according to some rules by chance, are there? Spring has a DI framework and I've found it decently powerful. With annotations it's not too bad to use, and configuration with Groovy is pretty easy. To answer your last question, do you have an example of what you're trying to do? If I understand you correctly, you want to do something similar to what Grails does. Grails (uses Spring) will load (and reload) arbitrary classes based on className by introspecting all classes in a given location. The "rules" are basically that the classes have to exist in a certain location. I'm sure you could do something similar.
|
# ? Jan 29, 2009 00:10 |