|
standard posted:Window -> Preferences -> Java -> Compiler -> Compiler Compliance level. LilMike posted:Alternatively, Warblade, check out the command line parameters for javac -source and -target, I think you'd want something like javac -source 1.3 -target 1.3... So it would only accept 1.3 compatible java and output 1.3 compatible bytecode. Bonus: you can specify these as attributes to the javac tag in your any build scripts. Thanks guys, but it doesn't seem to work that way. In eclipse I'm already at compliance level for 1.3. And in the javac task in Ant I'm specifynig the source and target values to 1.3. Edit: Oh, TRex already mentioned that. TRex EaterofCars posted:e: here -> http://java.sun.com/j2se/1.3/download.html Thanks but it seems Sun end of life'd Windows support for 1.3. Those downloads are only for Solaris.
|
# ? May 1, 2009 17:01 |
|
|
# ? May 8, 2024 21:38 |
|
Sorry, I was rushed this morning and didn't look at the link too closely Those sons of bitches made it hard to find, but here it is: http://java.sun.com/products/archive/j2se/1.3.1_20/index.html
|
# ? May 1, 2009 17:29 |
|
Thanks!
|
# ? May 1, 2009 18:46 |
So, I've read that the policytool security system of Java is basically meaningless and that I should actually just obtain a cert from somewhere online to be able to get out of the sandbox with my applet. What's a good cert authority to buy from that will ensure I get cross-platform support?
|
|
# ? May 3, 2009 20:19 |
|
So I've become quite comfortable using Java and I feel I have a decent grasp on the substantial concepts (control structures, arrays, basic graphics, AWT, files I/O, etc). I've gone through my book and done several exercises in each chapter dealing with these subjects, and I'm ready to move on and learn something a little more advanced. My question is: what should I learn? I'm thinking about looking into Swing. Is Swing very popular among Java programmers? Any suggestions would be great. Thanks!
|
# ? May 7, 2009 23:13 |
|
lazypeterson posted:I'm thinking about looking into Swing. Is Swing very popular among Java programmers? I used to do all of my programming in Swing, I stopped using it about 2 years ago, so it may have improved since I stopped using it. The problem I've seen with Swing is the tutorial applications you'll find online make it look like the easiest thing in the world. However, once you go beyond the simple one text box, one button, one label programs and start making anything remotely complex the the learning curve stops being a curve and turns into a brick wall. IDE's like NetBeans will try to hide a lot of the complexities but in the end they will harm you as you won't understand how to make your GUI dynamic.
|
# ? May 7, 2009 23:28 |
|
Hey everyone, I will be starting at a position in a week or two that requires EJB, but alas, I know nothing about it... can anyone recommend a decent book or online tutorial so I don't look like a complete jackass on my first day?
|
# ? May 8, 2009 00:09 |
|
Folks, I'm pretty new to reflection. I'm running a junit test and I'm trying to get at a private field in a super-super class.code:
quote:java.lang.IllegalArgumentException: Can not set java.lang.String field edu.sdsu.cs580.twitter.requests.TwitterRequest.urlString to java.lang.String
|
# ? May 8, 2009 07:27 |
|
lazypeterson posted:Any suggestions would be great. Thanks! Are you new to programming? It kind of sounds like it from your post. Swing would take you a while and provide lots of hours of learning. Seems like a natural step. However, part of learning a language is not just learning the syntax and the libraries, but also the conventions of the language like naming your variables and classes a certain way or understanding what is expected when you start overriding methods or implementing interfaces. For example when you override Object.equals you should also override Object.hashcode. Also, I suggest you read Effective Java by Joshua Bloch. It has a bunch of tips on how to be a better Java programmer. Warblade fucked around with this message at 06:51 on May 11, 2009 |
# ? May 8, 2009 07:39 |
|
Warblade posted:Folks, I'm pretty new to reflection. I'm running a junit test and I'm trying to get at a private field in a super-super class. The Object you pass into the Field.get() method needs to be the object whose field you're after. Try this instead: code:
|
# ? May 10, 2009 03:24 |
|
Contra Duck posted:The Object you pass into the Field.get() method needs to be the object whose field you're after. Try this instead: Thank you, that worked great!
|
# ? May 11, 2009 07:08 |
|
CT2049 posted:I used to do all of my programming in Swing, I stopped using it about 2 years ago, so it may have improved since I stopped using it. Perhaps a book will help? I remember applying for a job around 10 years ago (still a student), a Java programmer job. Being used with JBuilder (was version 2 or so at the time) and its designer, i never payed much attention to the GUI structure. At the job interview they gave me a very simple GUI app to do, in notepad. I had a day. Could not make it to behave how i wanted to for the life of me. The day after that (and not getting the job) I bought a Java Swing book (sorry, the name escapes me, there should be plenty of them now available). I learned a lot from it. What is a layout, how to use a layout properly and most importantly: How to use GridBagLayout and how to make your own if none of them does what you need. The MVC model is another thing I love the most in that library. I haven't found yet any other that is trying to even come close (in any other language), and its always pissing me off when I have to store the display string in the UI object and/or to store the data somewhere else. Today, after using Java for almost 10 years now at work, I simply love Swing. I have used it in many projects. Is it worth learning over another technology? No clue. Today the Web2.0 stuff seems to be the buzz. In my view its a great way to learn Java, just by programming in Swing and looking over to the source code to see how did they do stuff.
|
# ? May 11, 2009 21:56 |
|
rhag posted:Perhaps a book will help? If you are going to use Swing follow this man's advice. Get a book to guide you through the intricacies of Swing. I was just trying to warn about the learning curve. I've seen far to many people with failed projects because a professor, whose experience with Swing is creating a button and textbox GUI, tells them it is easy.
|
# ? May 11, 2009 22:01 |
|
Before learning Swing, it might be good for you to learn more about multithreaded (programs that do more than one thing at a time) programming. Not only is it really cool stuff, but you have to know it to make Swing programs. No exception, you need to know threads to do GUI programming.
|
# ? May 13, 2009 17:49 |
|
ynef posted:Before learning Swing, it might be good for you to learn more about multithreaded (programs that do more than one thing at a time) programming. Not only is it really cool stuff, but you have to know it to make Swing programs. No exception, you need to know threads to do GUI programming. Well...kinda, sorta and not really. As it is the case with everything, it depends. For very simple programs, probably you don't have to worry about it. For more complex ones, where the chances of having a long operation to execute are high, yes, it is a must. With Java 1.6 however, it's dumb easy to do multi-threading in Swing, and to be fairly safe (SwingWorker). As the Swing Tutorial explains there are a couple of things that you always need to be aware of: - All the event handling operations in Swing are executed in the event dispatch thread (EDT) - All code that deals with Swing components should be executed in this thread - A Swing component should not be modified in a different thread than the EDT This is why: - The main window of a swing application should be created and displayed using SwingUtilities.invokeLater(...) - When performing lengthy operations, use SwingWorker's doInBackground method to do your stuff, and then override done() to get the results and display them. - You can also listen for progress change using this class, and can also make incremental updates to a Swing component with the help of this class. Everything in a thread safe manner. For general knowledge though, yes, you do need to know what are threads, semaphores, synchronization, etc., basically whats with this concurrency crap everyone hates but has to use.
|
# ? May 13, 2009 18:17 |
|
Hello CoC, I was wondering how to run a desktop swing application without having the ugly console window staying in the background. I'm currently using a batch script which simply calls "java myMainClass" and the console window seems to just get stuck there until my GUI is closed. Is there a better way to do this? Edit: I'm using Windows if that makes a difference. I've also tried making a c++ executable which tries to start my java program through WinExec() but the problem still arises. FearIt fucked around with this message at 02:53 on May 14, 2009 |
# ? May 14, 2009 02:50 |
|
Package your program in a jar with a manifest that specifies myMainClass as the main class. Then you can just double-click on the jar to run the program.
|
# ? May 14, 2009 03:14 |
|
FearIt posted:Hello CoC, I was wondering how to run a desktop swing application without having the ugly console window staying in the background. javaw myMainClass if my memory serves me right.
|
# ? May 14, 2009 03:14 |
|
OddObserver posted:javaw myMainClass if my memory serves me right. Jackpot, thank you OddObs
|
# ? May 14, 2009 03:18 |
|
I need some guidance and want to know if this is feasible. I want to have an application which is client and server based. The client app (Swing-based) will send some information to a servlet. The servlet will place the request in a queue. The individual request may have to wait up to 20 minutes in some instances (maybe even more). The client must maintain an active connection and perhaps get updates to a field in the Swing app. Once the request is processed (this could be a quick or a long process), information is sent back to the client. Is this feasible? What should I utilize (such as looking into a work queue type process, or use a singleton in such a way that makes this possible)? What I had wanted to do was have the servlet dump the request into a directory. Then a scheduled task would fire every few minutes and pick up the next request from that directory. Once finished, an email would be sent to the user with the request information. This process didn't seem to be enough for the person needing this application.
|
# ? May 14, 2009 13:09 |
|
mister_gosh posted:I need some guidance and want to know if this is feasible. I am not sure if a servlet is the best way to go here. You could implement your own server, with your own protocol, but probably is not worth the effort. One idea would be to have either a RMI server or a web-service server. The client would make the request, and then it can check periodically what's the status. Something like: code:
Just an idea, im sure it can be done in a billion other ways.
|
# ? May 14, 2009 17:53 |
|
This is more of a Weblogic question than a straight up java question but I didn't want to start a new thread. Hopefully someone can answer. In the Weblogic console you can set the StuckThreadMaxTime attribute to any number. Say I set it to 10 seconds and this is the code handling my requests: code:
But what if the code is this? code:
The reason I ask is that we have a piece of code similar to the second example and we're seeing stuck thread messages in our logs. I'm trying to determine if weblogic reports stuck threads based on the length of time it spent on an entire request or if it's looking at how much time it's spending on a specific piece of that request. In short I'm trying to determine if foo.process() is the culprit or if it's the total wait time attached to the request. edit - Nevermind, I answered my question. For anyone who remains curious, the thread is the request. So the thread isn't getting stuck per se, just taking longer than the configured time. Weblogic doesn't know or care if the thread is stuck waiting on a lock for 15 seconds or if it's just executing a long query. Both threads look "stuck" from the server perspective. deedee megadoodoo fucked around with this message at 21:32 on May 15, 2009 |
# ? May 15, 2009 20:47 |
|
mister_gosh posted:I need some guidance and want to know if this is feasible. It is feasable, however, more difficult. The problem is a lot of clients will close the connection if they don't see any data flowing. The trick to this is to send out dummy characters as it waits. I had to this once as a proxy to the BIRT engine as its results would sometimes take hours to come back from the database. You could have the servlet fire off the scheduled task too. I'd need more information if you are dead set on using servlets. HFX fucked around with this message at 21:15 on May 15, 2009 |
# ? May 15, 2009 21:11 |
|
HFX posted:It is feasable, however, more difficult. The problem is a lot of clients will close the connection if they don't see any data flowing. The trick to this is to send out dummy characters as it waits. I had to this once as a proxy to the BIRT engine as its results would sometimes take hours to come back from the database. Why do you have to keep the connection open, though? Why can't you just assign a ID to each request, and when a client wants to know the status of the request, they poll the servlet, passing in the ID?
|
# ? May 16, 2009 03:45 |
|
Mill Town posted:Why do you have to keep the connection open, though? Why can't you just assign a ID to each request, and when a client wants to know the status of the request, they poll the servlet, passing in the ID? You underestimate the ability of the customers to make things like that not work.
|
# ? May 16, 2009 12:58 |
|
HFX posted:You underestimate the ability of the customers to make things like that not work. I don't trust their ability to keep a TCP connection open for more than a second, either.
|
# ? May 16, 2009 13:21 |
|
As a student project I have to write minesweeper in java. There is a bit of code in the middle of my program which tries to add an array of JButtons to a JPanel with a while loop.code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Minesweeper$Minesweeperz.Minesweeper(Minesweeper.java:34) at Minesweeper.main(Minesweeper.java:15) I don't know why im getting this error. Anyone see anything obviously stupid? edit: Ill edit in what each line of code is meant to do. Rob Filter fucked around with this message at 10:07 on May 20, 2009 |
# ? May 20, 2009 03:17 |
|
I don't understand why beginners always post code that obviously doesn't even compile. I mean, okay, you don't want to bother us with your entire program; that's commendable, and I appreciate that you've made the effort to select the parts of your program that seem important. You're even mostly right here, except that you've left out some very important contextual information, like which of these lines are declarations in the class and which are statements in a method. Anyway. You need to learn how to read code, how to think about what it's doing, and how to execute it on paper (or in your mind). What's the meaning of the expression new JButton[blah]? How is that different from new JButton(blah)? What does it mean to say blah1 = blah2?
|
# ? May 20, 2009 06:41 |
|
Rob Filter posted:As a student project I have to write minesweeper in java. There is a bit of code in the middle of my program which tries to add an array of JButtons to a JPanel with a while loop. What you're actually doing on this line code:
code:
Mine = mine MineGrid = mineGrid I also like to make variable names for any lists or collections (like your array) plural for readability's sake. mine = mines edit: Also you're going to get another ArrayIndexOutOfBoundsException when you try to reference Mine[24], since your array only has 24 objects. Here's an example of an easy way to iterate through an array using the array's length attribute. code:
placid fucked around with this message at 21:54 on May 20, 2009 |
# ? May 20, 2009 21:44 |
|
placid posted:Really clear advice Thank you, that makes perfect sense. I shall be fixing my code.
|
# ? May 21, 2009 07:42 |
|
I'm looking at uploading folders/multiple pictures through a java applet and I've never used java before. I want something roughly similar to what facebook has for its albums. Is there a barebones free example of this anywhere I can bend to my means ? If not how hard is this to do? I can't find any good resources on it anywhere, I get crappy shareware sites.
|
# ? May 27, 2009 00:18 |
|
Hello again CoC, I'm trying to add a right click JPopupMenu to a JTextArea so that I may easily copy, cut and paste. I've tried googling for examples but I haven't found any good ones that really fit what I'm trying to do. Any help would be great. Thanks CoC.
|
# ? May 27, 2009 04:04 |
|
FearIt posted:I'm trying to add a right click JPopupMenu to a JTextArea so that I may easily copy, cut and paste. Read the API docs for JPopupMenu and the tutorial linked from that page about how to use popup menus, and then come back with more specific questions if you're still having trouble.
|
# ? May 27, 2009 05:06 |
|
Sylink posted:I'm looking at uploading folders/multiple pictures through a java applet and I've never used java before. Are you new to programming or just to Java? Anyway, you're not going to be able to read local files from an unsigned applet, and signing is somewhat non-trivial. The search terms you want here are "JFileChooser" and "signed applet". Facebook might just use JavaScript.
|
# ? May 27, 2009 05:17 |
|
Im completely new to Java, and it seems Java holds the best way to do this. I think facebook uses java because it loads up the Java machine or w/e with the big coffee logo, unless javascript does that as well? Would it be easier in Javascript?
|
# ? May 27, 2009 05:26 |
|
Sylink posted:I think facebook uses java because it loads up the Java machine or w/e with the big coffee logo, unless javascript does that as well? That's definitely Java, but it doesn't mean that everything is Java. I don't know. Sylink posted:Would it be easier in Javascript? Can't really answer that; this is out of my area of expertise. Probably, though.
|
# ? May 27, 2009 06:27 |
|
Its looking like it might be easier to just upload a rar or something and take care of it from there.
|
# ? May 27, 2009 07:55 |
|
Sylink posted:I think facebook uses java because it loads up the Java machine or w/e with the big coffee logo, unless javascript does that as well? The most likely case of Java applets being used on Facebook is probably not from Facebook itself but some stupid ad. I can't really think of a good reason why image uploading would need Java on the client end unless you're adding some crazy stuff like photoshop-like features in your web browser. Image upload functions are typically heavy on the server side, which Javascript doesn't apply to (unless you count stuff like HaXe). So you're probably looking at using a language like PHP, Python, Java, C#, and so forth on the backend to read off your images or zip / rar file that's uploaded. After you pick your language, pick your appropriate megathread and off you go.
|
# ? May 27, 2009 15:10 |
|
As far as I know you can't upload more then one file at a time in JavaScript/HTML. There are AJAX hacks around this but it is still but you still need to open that dialog box for every single file you want uploaded. If you want to do a batch upload (whole folders or whatever) you would need to use a signed applet
|
# ? May 27, 2009 16:02 |
|
|
# ? May 8, 2024 21:38 |
|
necrobobsledder posted:The most likely case of Java applets being used on Facebook is probably not from Facebook itself but some stupid ad. I can't really think of a good reason why image uploading would need Java on the client end unless you're adding some crazy stuff like photoshop-like features in your web browser. dvinnen posted:As far as I know you can't upload more then one file at a time in JavaScript/HTML. There are AJAX hacks around this but it is still but you still need to open that dialog box for every single file you want uploaded. If you want to do a batch upload (whole folders or whatever) you would need to use a signed applet
|
# ? May 27, 2009 16:50 |