Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Java Exception Has Occurred with Batch File Argument
For awhile, I was running MegaMek with a batch file with this argument:

javaw -Xmx1200m -Dsun.java2d.d3d=false -jar MegaMek.jar

But the past couple days, I started getting a dialog box saying "A Java Exception has occurred".  So I tried this too:

javaw -Xmx1200m -Dsun.java2d.noddraw=true -jar megamek.jar

And I still get the same error.  I updated my Java to the latest version, and it still happens.

So what changed that isn't letting this work?  How can I fix it?

The MegaMek version I'm using is 0.41.21.
Is there an exception in the logfile?

edit:  I looked up the flag you are setting.  You can find the definition here:  Just search for the flag.  The documentation is very sparse, but it seems to indicate that it was used to fix issues with poor drivers in Windows 2000.  I feel like this shouldn't be relevant anymore.  However, I doubt this is causing your problem.  I'm sure there's something else, and it should be in the logfile.
The reason I use the flag is because I keep getting graphical corruption in MegaMek, whether or not my NVidia drivers are updated to the latest version.  This flag worked until recently.  I don't know what changed on my system that's not making it work.  That being said, I really don't know how to fix the graphics glitches I'm getting with MegaMek.

I just checked the megameklog.txt and didn't see any exceptions.

EDIT: The glitches seem to begin when I select a bot from the drop down list near the bottom of the unit selection dialog.  As soon as I click on that to select the name of a bot, the graphics start glitching out, with random images from the menus appearing where ever my mouse pointer goes.
I don't think that the flag is causing your issues, but without an error in the logfile, I'm not really sure what your issue is.  I'm kind of hoping someone else has some ideas.
(08-20-2016, 09:20 AM)Arlith link Wrote: I don't think that the flag is causing your issues, but without an error in the logfile, I'm not really sure what your issue is.  I'm kind of hoping someone else has some ideas.

The flag was not causing the issues.  The flag was preventing the issues.  Until I got the "A Java Exception has occurred" error recently, which appears to be caused by the flags when running the batch file.
If you run the jars directly, it runs?  You only get the stack trace when you run from the bat file?
Yes, the jars run directly.  But then I get the graphics glitches when I use the dropdown as outlined above.
If you just run `java -jar MegaMek.jar` from the bat file, does it work?  I'm wondering if it doesn't like your memory amount.
Apparently, that doesn't work.  Here's what I get from the command line:

C:\Program Files\MegaMek>java -jar megamek.jar
Exception in thread "main" java.lang.NoClassDefFoundError: gd/xml/ParseException

        at megamek.MegaMek.<clinit>(
Caused by: java.lang.ClassNotFoundException: gd.xml.ParseException
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more
Are you using Java 1.8? See the wiki:
I just installed 1.8.0_101 three days ago, though I have 1.6.0_26 for the SDK on my machine.  I just disabled 1.6.0 to see if it made a difference and it didn't.  Got the same error.

EDIT: I solved the problem.  I forgot about adding arguments to the megamek.l2j.ini file.  When I added the one to disable Direct3D, MegaMek worked properly and all of my graphics glitches disappeared when using the dropdown to select Princess in the unit selection screen.

But that begs the question: Is this actually a bug?

Possibly Related Threads…
Thread Author Replies Views Last Post
  Java exception on startup Zetrein 9 985 09-05-2017, 10:22 PM
Last Post: Hammer
  Bot freezes-Illegal Argument Exception p0pr0cks 3 1,484 01-18-2013, 12:53 AM
Last Post: Jayof9s
  Exception from class java.lang.NullPointerException: null Shaitan 4 1,748 04-15-2012, 05:07 AM
Last Post: Shaitan
  NPEs & Socket Exception Errors... ralgith 4 1,530 10-15-2011, 11:59 AM
Last Post: ralgith

Forum Jump:

Users browsing this thread: 1 Guest(s)