This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Java version compatibility  RSS feed

 
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

2 Questions:

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"?
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to show no matter how many times I proofread my submission I'll still mess it up.

"Program.java" should be "Program.jar".

How many cows do I need before I can edit a post?
 
Sheriff
Posts: 21692
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
...

See https://en.wikipedia.org/wiki/Java_class_file for more information.


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.
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shows Java 8, which I thought it was but didn't want to guess.  

That hex dump trick is good to know, thanks!

 
Saloon Keeper
Posts: 9996
208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.  

Thanks for the replies.
 
Sheriff
Posts: 24291
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jim Venolia wrote:Somehow my input (which I get via email) got some odd characters in it.



<irony>Really???</irony>

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.
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stephan van Hulst
Saloon Keeper
Posts: 9996
208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It actually looks pretty interesting! How long does it take between turns? I have to admit it looks a bit pricey though.
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It varies on the game, you choose when you sign up.  Fast games are 1 turn a week, normal 1 every 2 weeks, slow 1 a month.  If you poke around the website you'll find waiting lists for each game.

They also have other games.

Pricey?  I think it's $3/turn, I get a couple hours fun out of each turn.  Multi games are I think $15/turn.
 
Stephan van Hulst
Saloon Keeper
Posts: 9996
208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah okay, if the strategy part is hours per turn, the price seems reasonable. I might give a trial game a chance.
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stephan van Hulst
Saloon Keeper
Posts: 9996
208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by a position?
 
Jim Venolia
Ranch Hand
Posts: 505
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a normal game you are 1 of 6 player types.  That is a position  In a multi game you have 3 player types.  Those are positions.  The website probably describes it better.

I can provide a sample turn if you want.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!