Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: newer java version required to avoid fatal error on loading my faction mod  (Read 4513 times)

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile

hi,

i just released my first version of my new faction mod and few people got an fatal error on loading starsector,
luckily enough i found out that you need a newer version of java inside the starsector jre folder and that you have to allocate more ram to java.

http://fractalsoftworks.com/forum/index.php?topic=8726.0

With the ver. jre1.8.0_31 and higher the problem disappears.

(i tested it with a fresh starsector download and only with the mod needed shaderlib and the NGO mod itself)

greetings
Ahne
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17496
    • View Profile

Hi - can you clarify what you're looking for here?

(Btw: if your mod needs more than 1GB of memory *on loading starsector*, there's a good chance there are some memory issues in the mod. Most mod-related memory issues come up when loading/saving a long-running game, which makes more sense since the loading/saving process uses more memory than normal operation. Start-up on the other hand... let's just say it would take a lot of effort to legitimately run out of memory there. For comparison, vanilla could probably load the game just fine with somewhere between 100 and 200 MB.)
« Last Edit: June 27, 2015, 01:43:20 PM by Alex »
Logged

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile

Ok to allocate more ram was wrongly used here, i only wanted to tell that it's necessary to use a newer java version thats all.

If i get more informations about this issue i will tell.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17496
    • View Profile

So you're saying your mod will run with Java 8 but will not with Java 7, with the same amount of memory allocated? Hmm - that seems... rather unlikely. Seeing the actual error would help identify the issue, though.

One thing that could be a problem, for example, is the game simply failing to run with Java 7 due to it being 32-bit and there not being enough contiguous ram to allocate (32-bit Java can only allocate memory in the lower 3 gb of memory, so if say 8 gigs are available, a lot of the memory is useless for the game), which would not be an issue with 64-bit Java. But that'd mean the same error without the mod enabled.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 2873
    • View Profile
    • Bitbucket profile
    • Email

The error I got was:
Code
33534 [Thread-5] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ships/venture.png (using cast)
33535 [Thread-5] DEBUG com.fs.graphics.TextureLoader  - Loading [graphics/ships/atlas_af.png] as texture with id [graphics/ships/atlas_af.png]
33687 [Thread-5] DEBUG com.fs.graphics.TextureLoader  - Loaded 215.01 MB of texture data so far
33688 [Thread-5] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ships/atlas_af.png (using cast)
34264 [Thread-5] ERROR com.fs.starfarer.combat.D  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.?00000(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.o00000(Unknown Source)
at com.fs.starfarer.launcher.ModManager.?00000(Unknown Source)
at com.fs.starfarer.loading.G.super(Unknown Source)
at com.fs.oOOO.oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.?00000(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

(yeah, I don't understand it either)
Logged

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile

Yes that was exactly the error, does it work now for you with the a newer java version?

Two friends of mine said the loading bug disappeared but to know it from more people would be nice.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17496
    • View Profile

That looks like it might be an issue with a plugin class the game is looking for not being found.

It's hard to say why that'd happen, though - I want to say I saw someone having a similar issue with another mod, and they resolved it by cleaning up some duplicate classes they had lying around (iirc, they had two copies of the same class - possibly their ModPlugin implementation - one in the data/scripts folder, and one in a data/scripts package inside a jar), but I'm not 100% sure.

Either way, though, that this is almost definitely something that can be resolved in the mod and does not require Java 8. Using Java 8 might help by masking the problem, but the problem - whatever is causing the error in the first place - is still there in the mod.
Logged

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile

Yeah it's masking the error...but i don't know exactly what occurs that error.

Could it be that it has something to do with the compiler from the netbeans with the JDK 8 as source?

Anyways, no idea of how to approach that any further. I could try to use JDK 7 instead, though.
« Last Edit: June 28, 2015, 06:40:12 AM by Ahne »
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile

Yeah it's masking the error...but i don't know exactly what occurs that error.

Could it be that it has something to do with the compiler from the netbeans with the JDK 8 as source?

Anyways, no idea of how to approach that any further. I could try to use JDK 7 instead, though.

Always an approach, if in doubt, start disabling code and mod components one at a time until things are working again.

You can also do difference checks with some tools between your current version and past versions.

As Alex said, the error can be caused by having two copies of the same script, one in the JAR, another loose under data\scripts.
Logged

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile

Hey debido,

fixed the problem, it was indeed the JDK 8 version as a source in Netbeans. I used an older JDK 7 version, compiled the project and tested it with a clean starsector version (without any changes) and now no loading error.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1878
    • View Profile
    • Email

Your mod has been compiled with java 1.8 class file version (52).

Hence when the script loader attempts to load the compiled classes into Starsector's embedded java 1.7 VM (compatible upto version 51 only), the classloader fails (silently) with an UnsupportedClassVersionError.

The subsequent crash is a by-product of the mod code failing to load.

The fix is to recompile your mod with "-target 1.7", so you get class files compatible with Starsector's VM.

Though Starsector failing silently when it encounters an error loading precompiled mod code should probably be addressed too.

:edit:

Ninja'ed  ;)
Logged