|
dvinnen posted:Kinda sorta. It's in between a scripting language and a full compile I guess. Right, well at the moment, I can't even get the imported, unaltered JAR file to "run as applet" because it says the selection doesn't contain one. Any ideas?
|
# ? Nov 12, 2008 19:04 |
|
|
# ? Apr 28, 2024 16:04 |
|
Actually, I might be wrong about the decompiler, looked at some of my code compiled code with DJ and it mostly matches the java code. So I dunno, when I've used it before it's always given me code that looks like "Object object1 = new Object()" As for the applet, it runs in a browser right? What does the HTML code call? Should look something like this: code:
|
# ? Nov 12, 2008 19:20 |
|
code:
How do I then configue eclipse with the param? Sorry, I have tried to google these questions. It's difficult because I'm not entirely sure what I'm trying to do here.
|
# ? Nov 12, 2008 19:24 |
|
Decompile all the code, add it to an Eclipse project, right click on 'com.appname' and choose 'run as applet'. Not sure how much help it'll be without the original source code.
|
# ? Nov 12, 2008 19:28 |
|
dvinnen posted:Decompile all the code, add it to an Eclipse project, right click on 'com.appname' and choose 'run as applet'. I now get "applet not initialised" EDIT: That seems to be OK now. \/\/\/\/\/ Yeah, the class path is actually /folder/com.app Fruit Smoothies fucked around with this message at 19:46 on Nov 12, 2008 |
# ? Nov 12, 2008 19:38 |
|
Fruit Smoothies posted:I now get "applet not initialised" ugh, lots of things cause that. Usually has to do with the classpath isn't matching up. Also you try passing the parameter you have to it. Right click on the class and choose run configurations. There is a tab for parameters.
|
# ? Nov 12, 2008 19:45 |
|
dvinnen posted:ugh, lots of things cause that. Usually has to do with the classpath isn't matching up. Also you try passing the parameter you have to it. Right click on the class and choose run configurations. There is a tab for parameters. Yeah I've fiddled around. I'm now super confused, because it seems the applet it trying to create a HTML file. I have no idea if this is true for all applets, or just this one. Either way, I have got no idea where Java would create it if it was being run. Hell I'm not even sure if the applet compiled properly: code:
|
# ? Nov 12, 2008 20:08 |
|
Eclipse makes that file when it runs an Applet automatically. Generates the HTML to embed in a page or something, I always ignore it. No idea why it can't be read though. Is it even getting written? Permissions problem?
|
# ? Nov 12, 2008 20:25 |
|
dvinnen posted:Eclipse makes that file when it runs an Applet automatically. Generates the HTML to embed in a page or something, I always ignore it. No idea why it can't be read though. Is it even getting written? Permissions problem? Nothing to do with permissions. Users, Administrators and System have full access, and it's not read only either. Hell, eclipse has already generated "java.applet.policy" file in there. Does the attempt to read this file imply compiler success?
|
# ? Nov 12, 2008 20:45 |
|
Right, I'm getting literally nowhere with this thing. I copied the algorithm I wanted from the class file, trouble is, the decompiling process messed up some of the constant strings it uses, so I have no idea how on earth I can check it with java. Essentially, I want to rewrite the whole procedure in pascal however this is looking impossible without the source. I looked in using JNI to port the functions class' to delphi, but this looks like a lost cause. I am in no way competent enough in C++ to try and use the JNI. My next thought was if .class files can be compiled down to DLLs completely? It would make a lot of sense for Sun to make this possible, since the language is limited mainly by the need of a platform.
|
# ? Nov 13, 2008 01:47 |
|
When I'm done with a project in Eclipse, is there an easy/automated way to deploy the project as an executable JAR file? Or I guess I'm just asking, what's the best way to deploy an Eclipse project as an executable application?
|
# ? Nov 13, 2008 02:41 |
|
dancavallaro posted:When I'm done with a project in Eclipse, is there an easy/automated way to deploy the project as an executable JAR file? Or I guess I'm just asking, what's the best way to deploy an Eclipse project as an executable application? It should already be compiled to a JAR which you can run with java -jar <filename>
|
# ? Nov 13, 2008 07:48 |
|
dancavallaro posted:When I'm done with a project in Eclipse, is there an easy/automated way to deploy the project as an executable JAR file? Or I guess I'm just asking, what's the best way to deploy an Eclipse project as an executable application? Right click on the project, choose export, expand Java. You'll have the option for JAR and executable JAR.
|
# ? Nov 13, 2008 15:02 |
|
dvinnen posted:Right click on the project, choose export, expand Java. You'll have the option for JAR and executable JAR. This worked perfectly, thanks. Now my next question is how to access an image file from within the JAR. This is the code I use to load the image: code:
edit: I've narrowed the problem down to that line, specifically. No exception is thrown, the program just silently breaks. If I throw in some print statements directly before and directly after that line, the one before is printed, but the one after is not. The strange thing is, the program continues to work normally. It doesn't throw an exception, but somehow exits the try {}catch{} block... what the gently caress is going on here? dancavallaro fucked around with this message at 17:40 on Nov 13, 2008 |
# ? Nov 13, 2008 17:24 |
|
Google says to use a stream instead of File.code:
|
# ? Nov 13, 2008 18:52 |
|
dvinnen posted:Google says to use a stream instead of File. Yeah, I finally figured out that you can't create a File object from a JAR resource.. so I just got rid of the new File() and the .toURI() and it worked fine, because ImageIO.read() will take a URL to a resource.
|
# ? Nov 13, 2008 20:10 |
|
Yeah. The File class should really be called Path, and you can't use it to refer to things within JARs.
|
# ? Nov 14, 2008 10:40 |
|
Our spiteful instructor has added some lame requirements for an assignment for creating a java UI with a ball that changes colour according to the different buttons pressed. He's said that we have to do it all in one class and we can't write similar code multiple times. We've made a for-loop that adds actionListeners to the buttons, but the compiler complains that it can't access "i" in the following segment:code:
How do I fix this? I can't very well make "i" final.
|
# ? Nov 16, 2008 15:25 |
|
Create another class, not an anonymous class, that receives an integer in it's constructor.code:
|
# ? Nov 16, 2008 17:32 |
|
Boz0r posted:"Cannot refer to a non-final variable i inside an inner class defined in a different method" Under the hood, an anonymous class is just a normal class with some implicit final fields containing all the values of the variables it uses from the enclosing scope. That is, suppose I've got code like this: code:
code:
code:
|
# ? Nov 16, 2008 21:53 |
|
NetBeans users might want to look into SQE (Software Quality Environment). "SQE is an attempt at providing first class NetBeans integration for different Software Quality Tools as FindBugs, PMD, CheckStyle, Lint4j and Dependency Finder." The very latest snapshot for NetBeans 6.5 can be found here.
|
# ? Nov 18, 2008 02:12 |
|
I've been trying to send a large file using udp with multiple packets by splitting the file up but I have been having trouble. I tried implementing it as a FileStream and sending the bytes as packets one at a time but I have had a hard time splitting the file and having it remember where it was last. Is there any easier way to fragment the file into a specified chunk of data and then send it or are there any classes that handle this for you in udp?
|
# ? Nov 20, 2008 21:56 |
|
Use TCP instead? Otherwise, use NIO with the ByteBuffer and make an OutputStream that appends anything sent to it to the ByteBuffer and force out a datagram every time the ByteBuffer won't take any more bytes.
|
# ? Nov 20, 2008 22:12 |
|
If you're trying to stream a large file over UDP, you are basically going to have to reimplement everything that TCP does for you. I suppose you could be a bastard and ignore flow-control, but seriously, this is a large undertaking.
|
# ? Nov 21, 2008 00:39 |
|
I know this is an IDE question, but I don't want to really make my own thread for it. Is there a recommended plugin for eclipse to have FTP mapped to a project just like subclipse does for SVN servers? I want something that would just allow em to "commit" without having to upload in an external program. Thanks.
|
# ? Nov 22, 2008 04:26 |
|
This does SFTP, not seeing anything that FTP though. Of course the reason for this is that these things are "Team" providers for source control, and FTP isn't a source control system.
|
# ? Nov 22, 2008 10:51 |
|
Generic newbie java question: Is it possible to have a method return two values or variables without first putting them into an array and returning the array? From what I've found, this is impossible in Java and a lot of people have complained to Sun about it, but the exercise I'm working on insists it can be done. I'd love to be proven wrong since it would make my life a lot easier.
|
# ? Nov 23, 2008 04:09 |
|
A Curvy Goonette posted:Generic newbie java question: The very definition of a You can, however, create a class that contains only the two variables you want and return a member of that class.
|
# ? Nov 23, 2008 04:13 |
|
Just return them in some object that contains two fields.
|
# ? Nov 23, 2008 04:13 |
|
A Curvy Goonette posted:Generic newbie java question: in C++ i use std::pair a lot, and in Java I had to make my own quick class called Pair. So like 2 users above me said, just create a wrapper class for 2 values. You can make it generic and make hash and compareTo methods for it so you can use it almost anywhere in java.util.*
|
# ? Nov 23, 2008 20:28 |
|
Hey guys, I've got another question for you all. Hopefully it belongs here... I'm building an RCP project in Eclipse 3.4 and I'm getting a java.lang.VerifyError. I've got a class (Class A) which extends a parent (Class B). Class B is located in an external jar file that I import through my plugin.xml file on the Dependencies tab. The problem is that when I try to instantiate this object anywhere in my project, I get this error: code:
code:
in the constructor for a view, that view won't be able to load properly. However, if I write a public static main method inside the view, put the line in there and run the individual class as a java app, I don't run into any errors. I really don't understand why this is happening. If anyone has any insight it would be greatly appreciated! Thanks!
|
# ? Nov 25, 2008 17:48 |
|
This is a tad bit on the web application side of things, but if I need to move this, let me know. Using Struts, I have a JSP file that I'd like to display a message depending on the value of a variable. For a hypothetical example: Let's say the user inputs a value for x. Whenever x is 666 I want to to print "The devil's number is actually 616.", on the page, with the rest of the text, otherwise I don't want anything to show up. Right now I have it going to System.out, which is helpful, but I want to put it right on the page. Any suggestions, help?
|
# ? Nov 25, 2008 23:51 |
|
Clock Explosion posted:This is a tad bit on the web application side of things, but if I need to move this, let me know. look into action/field message/errors
|
# ? Nov 25, 2008 23:55 |
|
crm posted:look into action/field message/errors Does it matter that it's not associated with a bean?
|
# ? Nov 25, 2008 23:59 |
|
nm
Kennedy fucked around with this message at 16:33 on Nov 29, 2008 |
# ? Nov 28, 2008 17:47 |
|
I'm writing a program that's supposed to test various characteristics of arrays. I've completed the program, and everything works appropriately; however, I'm getting an error that resets my interactions after the program finishes running that says, "java.lang.NoClassDefFoundError: com/sun/jdi/VMOutOfMemoryException". I've never seen an error like this before, and I'm not sure how to handle it (Googling the error didn't come up with anything that made sense to me). Is this just another exception that I need to throw in declaring my method main?
|
# ? Nov 28, 2008 19:27 |
|
JulianD posted:I'm writing a program that's supposed to test various characteristics of arrays. I've completed the program, and everything works appropriately; however, I'm getting an error that resets my interactions after the program finishes running that says, "java.lang.NoClassDefFoundError: com/sun/jdi/VMOutOfMemoryException". I've never seen an error like this before, and I'm not sure how to handle it (Googling the error didn't come up with anything that made sense to me). Is this just another exception that I need to throw in declaring my method main? Increase how much memory you give to your program. You are probably trying to allocate a new array after you used up all memory. do something like java -Xmx1000m Alternatively you can try and force garbage collector to free some memory at specific points if you know you don't need it anymore. To do this, you can set the references pointing to memory you don't need anymore to null.
|
# ? Nov 28, 2008 19:39 |
|
hexadecimal posted:Increase how much memory you give to your program. You are probably trying to allocate a new array after you used up all memory. I checked to see that's the problem after your suggestion, but I don't think that's it. I added this to my program to see how much memory I had before and after calling the last method of my program: code:
|
# ? Nov 28, 2008 22:09 |
|
JulianD posted:I checked to see that's the problem after your suggestion, but I don't think that's it. I added this to my program to see how much memory I had before and after calling the last method of my program: I am not sure. Just try to use -Xmx and see if it helps. Also print stack trace of exception to System.err just use printStackTrace() on exception after you catch it.
|
# ? Nov 28, 2008 22:13 |
|
|
# ? Apr 28, 2024 16:04 |
|
I'm also having trouble giving the user a choice of bringing the input in from a file or inputting it themselves. Here's what I had written:code:
hexadecimal, I'm still in an intro Java class, so I've never used the commands that you're referring to, so I really don't understand what you're suggesting I do to handle the memory exception.
|
# ? Nov 28, 2008 22:22 |