Well dang. A program I use weekly, wrote maybe 6 years ago, and haven't touched it's jar file in 2, is now throwing an array out of bounds exception. Not an issue except I had a hard drive crash last October and nothing on that machine was recoverable (good backups FTW). I haven't written any Java since then and don't have a JDK installed on this machine. Nor do I know which version I developed the program on.
1) If I download Java 12 what are the odds my program will build without issues? No resources, just 3 .java files
2) Is there a way I can find out which JDK my Program.jar was built with?
2.1 I developed this under Eclipse, but got pissed at Eclipse for something or other and switched to something else, only to ultimately use Android Studio. No idea which was used for my current Program.java.
For 1 keep in mind this was maybe the third program I ever wrote in Java, and the first one over 100 lines (wc *.java shows 1417 lines). It's pretty much C with a bunch of Regexp's in it, nothing object oriented about it. I'm effectively parsing a log file.
For 2.1, does it matter? And how do I figure out what I used?
/ look at my first posts on this forums, it was trying to figure out how to do OO log file processing I found/joined this site
// years later, yeah, I could have done better
/// but who amongst you haven't looked at a learning project that was useful and thought "oops"?
Regarding 2. Open the class files in a HEX editor. Take a look at the 8th pair. The first pairs are always the same: ca fe ba be 00 00 00. Then you get the Java version:
* 34 for Java 8
* 33 for Java 7
* 32 for Java 6
Little side note: I was surprised a few months ago when I was checking class versions for compatibility reasons and found a 2e - that's Java 1.2, it was so old I didn't even recognize it as a Java version. Interestingly enough, it was Apache commons logging.
Unless your program used any of the removed APIs, such as javax.xml.bind, you're likely good to go. Even then you can easily download and add those APIs to your project as dependencies.
I'm thinking that if you download the latest version of Eclipse for Java Developers it probably won't have problems reading or converting your project, but even if it does I don't think it would be a lot of hastle to create a new project from existing source files.
Found the problem, has nothing to do with my .jar file. Somehow my input (which I get via email) got some odd characters in it. Evidently I parse a number, which isn't a number in this case, and get who knows what, then use that as an array index.
Jim Venolia wrote:Somehow my input (which I get via email) got some odd characters in it.
Sorry... I spent a lot of my working life writing code which parsed data from e-mails and did business-critical things based on the results. It's surprising how many different ways there are to get that wrong.
Yeah. Source is http://www.flyingbuffalo.com/swrules.htm, they claim they haven't changed anything and I believe them. If you look at the email headers there are half a dozen culprits, and I have no idea how to figure out who it is.
Wrote a sed script to clean the email, hopefully problem solved.
Give the game a shot, as long as it's not an anonymous game I'll give you hints and advice.
Thou shalt not try me. Mom 24:7
Stephan van Hulst
posted 1 year ago
It actually looks pretty interesting! How long does it take between turns? I have to admit it looks a bit pricey though.
Let me know if you want my C program written in Java
FWIW, I only play anonymous multi games nowdays. I don't have the time for diplomacy (plus I suck at it). In a normal game you have 15 players each playing 1 position. In multi you have 5 players each playing 3 positions.