FlorianPusse / OpenDS-CTS

13 stars 6 forks source link

Runing the java simulator without IntelliJ #1

Closed cindycia closed 4 years ago

cindycia commented 4 years ago

Hey Florian,

I am trying out the simulator but got stuck at the installation of OpenDS.

For some reason, IntelliJ just does not run on my Ubuntu 18.04. Is there a way to run the simulator directly from the command line?

I tried to go to ~/OpenDS-CTS/src/eu/opends/main/ and run javac Simulator.java, but got 100 errors saying: Simulator.java:22: error: package com.jme3.app does not exist import com.jme3.app.StatsAppState; ^ Simulator.java:23: error: package com.jme3.bounding does not exist import com.jme3.bounding.BoundingBox; ...

Thanks!

haklidir commented 4 years ago

Hey Cai,

Did you try downgrade Java Fx version?

sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2

I think, it works

FlorianPusse commented 4 years ago

Hi Cai,

sounds like it's missing a reference to JM3 (JMonkey Engine 3). Maybe you have to include that in the compilation which Intellij would do automatically. If IntelliJ doesn't work for you, you can also try Eclipse. That shouldn't make much of a difference.

cindycia commented 4 years ago

Hey Cai,

Did you try downgrade Java Fx version?

sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2

I think, it works

Neat! Now I can open Intellij, import the project, and run simulator.main with IntelliJ 18.3.6 (the 20 version does not seem to work). But there comes a runtime exception:

com.jme3.asset.AssetLoadException: An exception has occured while loading asset: Scenes/grassPlane/grass.png (Mipmapped)
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:261)
        ...
Caused by: javax.imageio.IIOException: I/O error reading PNG header!
    at com.sun.imageio.plugins.png.PNGImageReader.readHeader(PNGImageReader.java:315)
        ...
Caused by: java.io.IOException: Bad file descriptor
    at java.io.FileInputStream.readBytes(Native Method)
        ...

I have chosen JDK 1.8 during the import and Java level 8 in the project setting.

Thanks again for the help!

cindycia commented 4 years ago

Hi Cai,

sounds like it's missing a reference to JM3 (JMonkey Engine 3). Maybe you have to include that in the compilation which Intellij would do automatically.

Thanks for the hint. After fixing IntelliJ as @haklidir recommended, I can load the project now.

If IntelliJ doesn't work for you, you can also try Eclipse. That shouldn't make much of a difference.

I have tried Eclipse and didn't make it work. I probably need to modify the project settings, about which I really have no idea. Anyway, it should be good enough to have IntelliJ working now.

Thanks again!

cindycia commented 4 years ago

Just to mention that my system is Unbuntu 18.04 if that helps.

FlorianPusse commented 4 years ago

I think that's an issue with OpenDS not being able to read its own asset files.. Can you try deleting said image file? Sounds stupid, but that could actually work

cindycia commented 4 years ago

I think that's an issue with OpenDS not being able to read its own asset files.. Can you try deleting said image file? Sounds stupid, but that could actually work

That grass texture png seems to be necessary. After removing it complains:

java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:267)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
    at eu.opends.main.Simulator.main(Simulator.java:1834)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
    at com.sun.glass.ui.gtk.GtkApplication._isDisplayValid(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.isDisplayValid(GtkApplication.java:83)
    at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:67)
    at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
    at com.sun.glass.ui.Application.run(Application.java:146)
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
    ... 2 more
cindycia commented 4 years ago

Just some more info:

I can open the grass.png file on my computer. It is not corrupted. The header of the file looks like:

00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
00000010: 0000 0200 0000 0200 0803 0000 00c3 a624  ...............$
00000020: c800 0003 0050 4c54 45d0 d08f aecc 4e8b  .....PLTE.....N.
00000030: 7749 5389 2995 b06b b4d3 9153 8b10 ccb4  wIS.)..k...S....
00000040: 6f49 5111 afad 8e95 926b 8a73 32ac 976e  oIQ......k.s2..n
00000050: 698f 112a 310d 6956 2d76 a94a 3368 0d96  i..*1.iV-v.J3h..
00000060: cb4d ccb8 8f6e ad0e 91ca 2fd1 ed8e f3f4  .M...n..../.....
00000070: d668 7113 f4f7 b0ab b033 7788 3588 9846  .hq......3w.5..F
00000080: eff0 9246 351c 8888 4634 4d25 95ca 6c67  ...F5...F4M%..lg
00000090: 7735 7798 35d0 ed71 7878 3656 6725 ebd5  w5w.5..qxx6Vg%..

which seems like a proper PNG file.

cindycia commented 4 years ago

Hmm... I got it running by downgrading openjfx again: sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 Really not sure why I need to do it twice. But it works now.

Thanks!