HardwareSimulator.sh does not load (no error msg)

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

HardwareSimulator.sh does not load (no error msg)

Sweenu
Hello!

I'm on Arch Linux, i have jre8-openjdk installed and my HardwareSimulator.sh is executable but when I start it (./HardwareSimulator.sh) it just shows a white screen and no errors or whatsoever...

And if I run something like  "./HardwareSimulator.sh ../projects/01/And.tst" it outputs "Comparison failure at line 5" which I guess is not a normal behavior.

Does someone know where the problem could come from ?

Thank you,
Sweenu
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

ivant
Please make a copy of HardwareSimulator.sh and edit it in the following way:
  1. On line 23 (or thereabout) remove the & at the end of the line. Normally it will put the java process in the background, but we don't want that for now
  2. Add the following as a second line just below #!/usr/bin/env sh:
    set -x
    This will make bash display each command that it executes.
Now run the copy and paste the log here.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

Sweenu
Thank you for your fast reply! Here's the output :

+ unset CDPATH
++ test -L ./copyHS.sh
++ echo ./copyHS.sh
+ script=./copyHS.sh
+ dir=/home/sweenu/nand2tetris/tools
++ dirname ./copyHS.sh
+ cd .
+ '[' '(' 0 -gt 1 ')' -o '(' '' = -h ')' -o '(' '' = --help ')' ']'
+ '[' 0 -eq 0 ']'
+ java -classpath :bin/classes:BuiltIn:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar HardwareSimulatorMain
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

Sweenu
In reply to this post by Sweenu
By the way I was wrong, only the GUI fails to work. The scripts works perfectly for testing.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

ivant
The output looks OK. Didn't java print something as well?
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

Sweenu
No :/
This is the only thing that got logged out.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

ivant
The only thing I can think of, is if you've installed the headless jre. This means that it is designed to run on a server does not include any GUI stuff in it. I still think it should have displayed something, though.

You can also get the last command (java -classpath ...) and try to run it directly and see what happens.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

Sweenu
I am positive that I have the version with the GUI stuff in it but could it be trying to use the headless version anyway ?
I tried the command directly and there was no output and still this white screen of death.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

cadet1620
Administrator
You could also try running "java -version" from the terminal command line and check that it can identify itself.
My laptop says
[D:/TECS]
% java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode)
[D:/TECS]
%
Assuming that works, in your script with the trace flag set, comment out the java -classpath and put in the java -version command and see if it runs from the script and identifies itself.
# java -classpath "${CLASSPATH}:
java -version

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

Sweenu
Both of these things works :/ I don't quite understand what the problem is. I'm juste gonna use a distrib that has a desktop environnement i guess... just a window manager might not be enough for some reason.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

davidshepherd7
I get exactly the same problem on Ubuntu 16.04 with a custom (fairly minimal) .XSesson and XMonad as my window manager.

It works if I use a full Gnome session, so yeah I guess it depends on a desktop environment somehow.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

davidshepherd7
I found the problem: for some (batshit insane) reason Java GUI apps only work if they recognise the name of your window manager! If you manually set XMonad's window manager name to "LG3D" everything works fine.

source
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

ivant
Good to know! I'm now curious to know why they did this :)
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

ivant
Aha! There's a better way to fix this, as described here. The changing of the name also works, but this may clash with other extensions which try to change the Xmonad name to something else.
Reply | Threaded
Open this post in threaded view
|

Re: HardwareSimulator.sh does not load (no error msg)

davidshepherd7
Yeah that's a much better way, thanks for letting me know.

For future reference in case that link dies: the better way is to set the environment variable _JAVA_AWT_WM_NONREPARENTING=1.

For example by running the simulator as:

    _JAVA_AWT_WM_NONREPARENTING=1 ./tools/CPUEmulator.sh

or by putting

    export _JAVA_AWT_WM_NONREPARENTING=1

in your .bashrc/.zshrc file.