CG Local

How do I run the jar file? I’m on Linux and the auto-launch fails and I get Could not find or load main class fxlauncher.Launcher if I do java -jar CG\ Local.jar

openjdk version “1.8.0_151”

Same thing happens with newest JRE.

1 Like

I have the local one running now – using the newest JRE and not message up the path helps. :slight_smile:

But the connection isn’t working in CodingGame.

Can I see logs anywhere?

The CGLocal client says “Listening on port 53135”

Alright, I don’t know why this happens exactly, but I was able to reproduce the bug in an Ubuntu VM and it seems to be the case that CG Local does not work with OpenJDK, but does work with the Oracle JDK.

I will look into the issue and update the launcher when it does work with OpenJDK, but till then the only advice I can give is to use the Oracle JDK (I tested it with 1.8.0_161).

By the way, logs should appear when running with java -jar CG\ Local.jar like this:

1 Like

I have it working after a few hiccups. I like it. This will help a lot.

A few notes for others:

  • It connects to 127.0.0.1, thus if using a proxy be sure that isn’t proxied
  • Java keeps listening to the local address after ending (Ctrl+C) the program, thus wait a before launching again
  • If something goes wrong reload the CodinGame page and editor, then toggle the external edtiro on/off
  • If the connection works the external editor will turn to “On”, if it stays “Off” or nothing is highlighted it isn’t working.
  • The "Synchrnonizing " means the initial download worked,
  • Test that it works now by typing in the local file and pressing save.
1 Like

The issue with OpenJDK is that OpenJDK does not include JavaFX. When running on Ubuntu, that bug can be fixed by running the following:

sudo apt-get install openjfx

On other systems a similar command should be possible.

Not directly related but:

With the Java Platform Module System in place since Java SE 9, it now more viable to decouple JavaFX from the JDK, in order to make it available as a separate download. This will make it easier for developers using JavaFX to have more freedom and flexibility with the framework. Moreover, with our focus on increasing the release cadence of OpenJDK, JavaFX needs to be able to move forward at a pace driven by the contributions from Oracle and others in the OpenJFX community. Oracle plans to implement this decoupling starting with Java 11 (18.9 LTS).

JavaFX was not the best choice :stuck_out_tongue: Will require a extra download in all OS in the future.

But thanks, I was searching this plugin for some time.

Open JFX isn’t that hard to install (on Ubuntu it’s a simple sudo apt-get install openjfx), so I don’t think it’ll be a huge problem. The bigger problem is that, currently, CG Local is not compatible with Java versions greater than 8 because of the launcher that is being used.

Hi, finally got your tool working @Jasperr! On ubuntu I went for the oracle-java instead of openJdk+openFX (I followed this tuto on medium to handle the different versions of Java). Thank you, my efficiency is already improving :slight_smile:

No problem! The project is kinda on hold (it works, so there’s no need to edit it), but if I ever find some motivation again I will look into packaging a compatible JRE + JavaFX with the application to get rid of the extra dependency.

If you want a better Java version manager, SDKMAN might be interesting for you. When installed, you can simply install Oracle Java 8 with sdk install java 8.0.181-oracle (and similarly with other versions/distributions/JVM-related software).

1 Like

Hi Jasperr,
I’m trying to install CG Local on Firefox on a Windows system. The extension seems to work well but I can’t download the CG App. The link https://jaspervanmerle.com/cg-local/files/CG%20Local.jar is broken. The site seems to be suspended. Like I’m not a Java devlopper I haven’t any tool to compile the source. Is there another link to download the jar file ?

Whoops. I forgot that those files were still on that website, which I stopped paying for because I wasn’t using it anymore.

I will update the application this weekend (probably saturday, got other priorities at the moment) and release the jar file on GitHub. I’ll add a post to this topic once that’s done.

If you want to use it before that, you can clone https://github.com/jmerle/cg-local-app, move into the directory with your preferred commandline and run the application with the gradlew run command.

1 Like

I released version 1.1.0 of the application which fixes the issue. The application is now distributed as a single jar with all dependencies inside, instead of the previous version which was merely a launcher which downloaded all necessary files at runtime.

You can download the new jar file on the repository’s GitHub releases page. The readme of the repository and the initial post of this topic are updated to reflect those changes.

4 Likes

Cool, thank you!

it didn’t work with java 10, so i used this
https://docs.datastax.com/en/cassandra/3.0/cassandra/install/installOpenJdkDeb.html
to install java 8 and then i reinstalled openjfx and now it works

1 Like

I’ll just leave this here, might help someone:

aptitude install openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless
aptitude install openjfx=8u111-b14-1 libopenjfx-jni=8u111-b14-1 libopenjfx-java=8u111-b14-1
1 Like

It has been a while since CG Local has gotten an update, but in preparation for the Spring Challenge and because Chrome has decided to continue phasing out Chrome Apps I decided to perform some well needed maintenance on both the extension as well as the application.

Extension changelog:

  • Removed the usage of innerHTML.
  • Fixed a bug where the extension would not disconnect from the CG Local application when moving away from CodinGame while being connected to the application.

Application changelog:

  • Moved the UI from JavaFX with TornadoFX to Swing. This change makes the application work with Java versions newer than 8 and means it is no longer required to run the application with a JRE or JDK with JavaFX available.
  • Fixed a bug where the server would sometimes not be able to bind to its port if the application was quit a short time ago.

If you have the extension installed your browser will automatically update it. If you have the application installed, you can download the new version here. I have also updated the opening post of this topic to reflect these changes.

5 Likes

That’s very useful tool.

The thing I’m missing is possibility to choose which Auto Play action is preferable. In a contest it’s usually “Play in same conditions” as want to compare results after code change. Now Auto Play must be off and one have to press it manually in the CG.

Sorry for the late reply, I completely forgot about your feature request.

Unfortunately this is not possible. The API which CG Local uses to communicate with the CodinGame IDE has a “play” action, but does not have a way to configure what gets played nor is there a “replay” action. I have tried to come up with a workaround, but there doesn’t seem to be a reliable way to acquire a reference to the IDE’s internal API so that’s a no-go too.

1 Like

Still, typing via CG Local is way more enjoyable then fighting with CG editor
I appreciate your work :wink:

Edit: This option is not important any more as one can “Play in same conditions” just setting up manual seed in the CG puzzle option.

1 Like

I just released a new version of the application based on a user’s feature request and to fix a minor bug. If none of these changelog items apply to your workflow you can safely keep using the old version:

  • Added support for sending HTTP GET requests to http://localhost:53135/play to trigger “Play All Testcases” on CodinGame. This works regardless of what Auto Play is set to in CG Local’s settings.
  • Fixed the “Open CodinGame” button on Linux systems that don’t have the GNOME libraries installed.

You can find the updated jar in the GitHub release.

1 Like