Cant get Poweshell to run Terminal with JDK-14

I tried most of the day… (and i am a professional programmer!)
newest JDK… proper path statement… javac -version says jdk-14

gradle installed too (and validated), and i didnt need to since i am using python

and all i get is the classic compile error.

Start run a match
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: com/c1games/terminal/Terminal has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Finished running match

and only one more day to enter… ha ha!

Ok… finally got it working…
JDK-14 does not update path or java_home
you will probably have to delete the path statements for oracle pointing to JRE in favor of one for JDK

many places set up Java_home so that %Java_home% will work in path
it doesnt (at least in win 10 my version)… the path has to be C:\Program Files\Java\jdk-14\bin

i have yet to find out how this affects other things on my system as the browers will no longer point to the JRE but to the JDK this way (i am presuming).

python scripts/run_match.py python-algo python-algo at least is running (SORT OF)

its now giving this
SAPlayer 1 python-algo: py : The term ‘py’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
SAPlayer 1 python-algo: spelling of the name, or if a path was included, verify that the path is correct and try again.
SAPlayer 1 python-algo: At M:\C1_Terminal\Storage\C1GamesStarterKit-master\python-algo\run.ps1:4 char:1
SAPlayer 1 python-algo: + py -3 $algoPath
SAPlayer 1 python-algo: + ~~
SAPlayer 1 python-algo: + CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException
SAPlayer 1 python-algo: + FullyQualifiedErrorId : CommandNotFoundException
SAPlayer 1 python-algo:
SAPlayer 2 python-algo: py : The term ‘py’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
SAPlayer 2 python-algo: spelling of the name, or if a path was included, verify that the path is correct and try again.
SAPlayer 2 python-algo: At M:\C1_Terminal\Storage\C1GamesStarterKit-master\python-algo\run.ps1:4 char:1
SAPlayer 2 python-algo: + py -3 $algoPath
SAPlayer 2 python-algo: + ~~
SAPlayer 2 python-algo: + CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException
SAPlayer 2 python-algo: + FullyQualifiedErrorId : CommandNotFoundException

since i have yet to modify things, i dont know if this is normal…
sadly, i only have today to enter, and a fear no one will answer :frowning_face:

if anyone has in them to help, i would appreciate it…

Can you try the following command using Powershell:
…\C1GamesStarterKit-master> scripts\run_match.ps1 java-algo/algo-target python-algo

here are the results

scripts\run_match.ps1 java-algo/algo-target python-algo
p1:
java-algo/algo-target\run.ps1
p2:
python-algo\run.ps1
Starting Engine: sept2019
Starting single worker game.
Looking for Config file at:
M:\C1_Terminal\Storage\C1GamesStarterKit-master/game-configs.json
java-algo/algo-target\run.ps1
python-algo\run.ps1
Saving replay: M:\C1_Terminal\Storage\C1GamesStarterKit-master\replays\p1-22-03-2020-18-00-32-1584914432722-618769923.replay
P1 Name: algo-target seasonMode:5
P2 Name: python-algo seasonMode:5
Waiting for: 3000 before starting first turn.
SAPlayer 2 python-algo: py : The term ‘py’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
SAPlayer 2 python-algo: spelling of the name, or if a path was included, verify that the path is correct and try again.
SAPlayer 2 python-algo: At M:\C1_Terminal\Storage\C1GamesStarterKit-master\python-algo\run.ps1:4 char:1
SAPlayer 2 python-algo: + py -3 algoPath SAPlayer 2 python-algo: + ~~ SAPlayer 2 python-algo: + CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException SAPlayer 2 python-algo: + FullyQualifiedErrorId : CommandNotFoundException SAPlayer 2 python-algo: Done waiting starting first turn. Algo Crashed. Crash: false !processIsAlive: true Algo Crashed. Crash: false !processIsAlive: true Algo Crashed. Crash: false !processIsAlive: true Algo Crashed. Crash: false !processIsAlive: true Algo Crashed. Crash: false !processIsAlive: true Invalid command, couldn't json for player 0 : {"debug":{"printMapString":false,"printTStrings":false,"printActStrings":false,"printHitStrings":false,"printPlayerInputStrings":false,"printBotErrors":true,"printPlayerGetHitStrings":false},"unitInformation":[{"turnsRequiredToRemove":1,"refundPercentage":0.75,"cost1":1.0,"getHitRadius":0.01,"upgrade":{"startHealth":120.0},"unitCategory":0,"display":"Filter","startHealth":60.0,"shorthand":"FF"},{"refundPercentage":0.75,"cost1":4.0,"upgrade":{"shieldRange":7.0,"shieldPerUnit":4.0},"shieldRange":3.5,"shieldPerUnit":3.0,"display":"Encryptor","shorthand":"EF","turnsRequiredToRemove":1,"shieldBonusPerY":0.0,"getHitRadius":0.01,"unitCategory":0,"startHealth":30.0,"shieldDecay":0.0},{"attackDamageWalker":16.0,"attackRange":3.5,"turnsRequiredToRemove":1,"refundPercentage":0.75,"cost1":6.0,"getHitRadius":0.01,"upgrade":{"attackDamageWalker":32.0},"unitCategory":0,"display":"Destructor","startHealth":75.0,"attackDamageTower":0.0,"shorthand":"DF"},{"attackRange":3.5,"selfDestructDamageTower":15.0,"cost2":1.0,"metalForBreach":1.0,"display":"Ping","selfDestructStepsRequired":5,"shorthand":"PI","playerBreachDamage":1.0,"speed":1.0,"attackDamageWalker":2.0,"getHitRadius":0.01,"unitCategory":1,"selfDestructDamageWalker":15.0,"startHealth":15.0,"selfDestructRange":1.5,"attackDamageTower":2.0},{"attackRange":4.5,"selfDestructDamageTower":5.0,"cost2":3.0,"metalForBreach":1.0,"display":"EMP","selfDestructStepsRequired":5,"shorthand":"EI","playerBreachDamage":1.0,"speed":0.5,"attackDamageWalker":8.0,"getHitRadius":0.01,"unitCategory":1,"selfDestructDamageWalker":5.0,"startHealth":5.0,"selfDestructRange":1.5,"attackDamageTower":8.0},{"attackRange":4.5,"selfDestructDamageTower":40.0,"cost2":1.0,"metalForBreach":1.0,"display":"Scrambler","selfDestructStepsRequired":5,"shorthand":"SI","playerBreachDamage":1.0,"speed":0.25,"attackDamageWalker":20.0,"getHitRadius":0.01,"unitCategory":1,"selfDestructDamageWalker":40.0,"startHealth":40.0,"selfDestructRange":1.5,"attackDamageTower":0.0},{"display":"Remove","shorthand":"RM"},{"display":"Upgrade","shorthand":"UP"}],"timingAndReplay":{"playReplaySave":1,"waitTimeBotMax":35000,"waitTimeManual":1820000,"waitForever":false,"playWaitTimeBotSoft":5000,"waitTimeEndGame":3000,"waitTimeBotSoft":5000,"playWaitTimeBotMax":35000,"replaySave":1,"storeBotTimes":true,"waitTimeStartGame":3000},"resources":{"bitsPerRound":5.0,"coresPerRound":5.0,"startingBits":5.0,"turnIntervalForBitCapSchedule":10,"turnIntervalForBitSchedule":10,"bitRampBitCapGrowthRate":5.0,"bitDecayPerRound":0.25,"roundStartBitRamp":10,"bitGrowthRate":1.0,"startingHP":30.0,"startingCores":40.0,"maxBits":150.0},"seasonCompatibilityModeP2":5,"seasonCompatibilityModeP1":5} com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path
at com.google.gson.Gson.fromJson(Gson.java:899)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.c1games.terminal.game.Parser.processInputForPlayer(Parser.java:131)
at com.c1games.terminal.game.Parser.processInputBuild(Parser.java:115)
at com.c1games.terminal.game.GameMain.runLoop(GameMain.java:318)
at com.c1games.terminal.game.GameMain.startGame(GameMain.java:175)
at com.c1games.terminal.game.GameMain.main(GameMain.java:150)
at com.c1games.terminal.Terminal.main(Terminal.java:139)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.Gson.fromJson(Gson.java:887)
… 8 more
Invalid command, couldn’t json for player 0 : {“p2Units”:[[],[],[],[],[],[],[],[]],“turnInfo”:[0,0,-1,0],“p1Stats”:[30.0,40.0,5.0,0],“p1Units”:[[],[],[],[],[],[],[],[]],“p2Stats”:[30.0,40.0,5.0,0],“events”:{“selfDestruct”:[],“breach”:[],“damage”:[],“shield”:[],“move”:[],“spawn”:[],“death”:[],“attack”:[],“melee”:[]}}
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path at com.google.gson.Gson.fromJson(Gson.java:899) at com.google.gson.Gson.fromJson(Gson.java:852) at com.google.gson.Gson.fromJson(Gson.java:801) at com.c1games.terminal.game.Parser.processInputForPlayer(Parser.java:131) at com.c1games.terminal.game.Parser.processInputDeploy(Parser.java:228) at com.c1games.terminal.game.GameMain.runLoop(GameMain.java:324) at com.c1games.terminal.game.GameMain.startGame(GameMain.java:175) at com.c1games.terminal.game.GameMain.main(GameMain.java:150) at com.c1games.terminal.Terminal.main(Terminal.java:139) Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.Gson.fromJson(Gson.java:887)
… 8 more
Algo Crashed. Crash: false !processIsAlive: true
Winner (p1 perspective, 1 = p1 2 = p2): 1
Algo Crashed. Crash: false !processIsAlive: true
Algo Crashed. Crash: false !processIsAlive: true
Waiting to exit finished game.
sent game end playerIndex: 0
sent game end playerIndex: 1
sent game end playerIndex: 0
sent game end playerIndex: 1
Done waiting now exiting finished game.
Hard Exiting Now
Closing stream
Closing playerIndex: 0
Closing stream
Closing playerIndex: 1
Exited for loop
End of main
Closing stream
Closing stream
(base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master>

Maybe something with you python version or the PATH to your python version is missing.

Can you call ‘py’ from powershell?

Hi
I have a path to the anaconda3 directory C:\Anaconda3\
and anaconda scripts C:\Anaconda3\Scripts

entering py

py : The term ‘py’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • py
  • ~~
    • CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

I could try to point a path to an envs python38 i have in my anaconda3 setup…
but it shouldnt be different since 3.8 is what i have upgraded everything to

thanks for the help!!!

as a precaution i ran the following

conda update anaconda

conda install anaconda

conda update -n root conda

conda update --all

this actually updated things i somehow didnt have…
it didnt solve the problem, but i bet it stopped future problems before they occur

will keep trying…
thx

PS ad this to the list too
conda init powershell
[mine came up no change]

oh… typing python works fine… typing py does not

Loading personal and system profiles took 681ms.

(base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master> python
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.

(base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master> (base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master> py py : The term ‘py’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • py
  • ~~
    • CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

checking if modules loaded… using Get-Module

Loading personal and system profiles took 664ms.
(base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master> Get-Module

ModuleType Version Name ExportedCommands


Script 0.0 Conda {Add-CondaEnvironmentToPrompt, Enter-CondaEnvironment, Exi…
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con…
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS…

notice that the first its adding is the Conda environment…
sigh sigh and double sigh

conda info when run gives this

(base) PS M:\C1_Terminal\Storage\C1GamesStarterKit-master> conda info

active environment : base
active env location : C:\Anaconda3
shell level : 1
user config file : C:\Users\Admin.condarc
populated config files : C:\Users\Admin.condarc
conda version : 4.8.3
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages : __cuda=10.2
base environment : C:\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Anaconda3\pkgs
C:\Users\Admin.conda\pkgs
C:\Users\Admin\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\Admin.conda\envs
C:\Users\Admin\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.3 requests/2.23.0 CPython/3.7.6 Windows/10 Windows/10.0.18362
administrator : False
netrc file : None
offline mode : False

This should answer the question: https://stackoverflow.com/questions/50896496/what-is-the-difference-between-py-and-python-in-the-terminal

" py is the Python launcher which is a utility that comes with Python installations on Windows. It gets installed into C:\Windows\ so it’s available without requiring PATH modifications. The Python launcher detects what Python versions are installed on your machine and is able to automatically delegate to the right version. By default, it will use the latest Python version that is on your machine. So if you have installed 2.7, 3.5 and 3.6, running py will launch 3.6. You can also specify a different version by doing e.g. py -3.5 to lauch 3.5, or py -2 to launch the latest Python 2 version on your machine."

Regarding Anaconda: “those versions simply won’t be available through the Python launcher by default”

I think you have to install it separately to anaconda or figure out how to make your anaconda versions available to the Python launcher.

Well,
at least people reading are learning a lot… :slight_smile:

will look into anaconda and the python launcher… its a thread to follow and unravel
what i find out, i will post like the other stuff…

thanks felix… you been awesome!!!

Ok… got it to work… but boy did i read alot… (thanks felix)

there were several solutions that people had online.
one was to install another version of python, then get the py.exe, then uninstall (or leave the version)
i didnt like that…

then someone wrote a msi to install the py.exe
but given its an untrusted source…
i didnt like that

so i went with a way that no one suggested, but decided was the best (for me)
i went into the ps1 and changed

py -3 $algoPath
to
python $algoPath

if the only point of py is to run python, and all my versions were high enough
and the path to anaconda worked to run python, then just run python directly

i do not know if the upload uses the ps1 file…
if it does then it has to be switched back before cmpressing and upload
if not, then it doesnt matter… just use python over py -3

Is windows: True
Algo 1: python-algo\run.ps1
Algo 2: python-algo\run.ps1
Start run a match
Starting Engine: sept2019
Starting single worker game.
Looking for Config file at:
M:\C1_Terminal\Storage\C1GamesStarterKit-master/game-configs.json
python-algo\run.ps1
python-algo\run.ps1
Saving replay: M:\C1_Terminal\Storage\C1GamesStarterKit-master\replays\p1-23-03-2020-23-06-27-1585019187473-1412562487.replay
P1 Name: python-algo seasonMode:5
P2 Name: python-algo seasonMode:5
Waiting for: 3000 before starting first turn.
SAPlayer 1 python-algo: Random seed: 4523091684352601304
SAPlayer 1 python-algo: ---------------- Starting Your Algo --------------------
SAPlayer 2 python-algo: Random seed: 4680411426409789271
SAPlayer 2 python-algo: ---------------- Starting Your Algo --------------------
Done waiting starting first turn.
SAPlayer 1 python-algo: Configuring your custom algo strategy…
SAPlayer 1 python-algo: Performing turn 0 of your custom algo strategy

here is the replay from the test… it appears this works fine…
and its a good answer… as its not too hard to have two files… and change them if needed
so the next question is whether you have to change the ps1 file back before uploading to the system

p1-23-03-2020-23-06-27-1585019187473-1412562487.replay (649.5 KB)

I have not tested it, but I would guess that before you upload it the file run.ps1 has to be like that py -3 $algoPath to be able to work.

But as a workaround for local testing, I think it should be possible to modify the file scripts/run_match.ps1 to not call the original run.ps1 and instead call a differently named version of that file with your changes:
python $algoPath

1 Like

Either way will do… and its a lot easier to do that than to install a null version of python just to get py.exe
I also like it better as it is much higher security for my system… without py.exe a rogue python script can’t be run accidentally… given i sometimes have clients and they have security needs, this is a big plus in the long run.

i would suspect that the PS1 is not used by the C1 system to run, they would not need to
though running with python instead is a better thing than running with py - it should be the norm
it would work with all installations, not just if you did this through windows, which with anaconda and other recommendations on not letting installs update paths (and that unless you install for all users).

should be simple enough to test though…
Now i have to figure out how to compress… :smile:

1 Like

Ya we just use the run.sh because our servers are on linux.

2 Likes

Call it an edumacated guess…
this would mean that bypassing py.exe is just fine, and the added trouble of changing before submission is not necessary… this may get more people to participate rather than having them give up fighting their own systems to get them to work…

hopefully this turns out to be a positive thread for many

thanls for the info C1Junaid!!!

1 Like

OK, I recently needed to reinstall the starter kit on a new windows environment … and this java problem gets me EVERY time. I don’t wanna thing how many new players give up on this step :frowning: .
The issue is like follows:

  1. Usually or by default, windows has Java 8 installed, and linked in the path.
  2. By following the installation guide to get Java 10, you end up installing 11+ as 10 is no longer supported.
    3a. Testing the starter kit, the gives version mismatch, that combined with the point above, can be easily confused that you did not installed the correct version …
    3b. You actually need 3 additional steps to make it work:
  • remove old versions of java,
  • add the new version to the path,
  • restart windows
    Missing any of them leads to frustrations big frustration with no clear warnings to follow on :slight_smile:

I was thinking this information in the git installation steps, as a Troubleshooting section …
when I found out that there IS already a the needed information … linked there.
May be adding a more detailed Troubleshooting section, with the specific use cases and how to proceed will save some new players. I can write it up, just not sure where is the best place to put it.

May be a forum post, to collect ALL common start up errors, with solutions (and we can build it and clean it up over time) then pin / link / extract it where needed.

3 Likes

Created this thread in response. Still working out the details/wording.

Hi Ryan…
what can i do to help from this post… as you can see, i avoided using windows because it was easier to just call python itself given my installs were all above the minimum… maybe we dont need py.exe anymore?

now my issue is figuring out how to run hundreds of rounds or a loop that can run hundreds so that its easier to write machine learning code using pytorch (or something similar)…

the more i play in this, the more it seems necessary to write my own game env - which would be a bear and annoying to keep up with what is done in the real game (and hard to match… but if they can remake final fantasy VIII, anything is possible… ha ha)

maybe im just too old having done this code stuff since the 1970s… :rofl::rofl::rofl::pray::pray:

1 Like

Demorf…
most of my issue with java was getting things to run off the JDK not the JRE… which really required the path statements to be fixed up after installing…

as far as getting it to run without py.exe (because i use anaconda), i just changed the py reference to python and removed the -3 in the powershell scripts…

as mentioned below… running a loop environment to do round after round after round is the next pain in the [censored]…

1 Like

This post is designed as an entry point and a place to consolidate community feedback and solutions to technical issues. If you are interested, you can create a post describing the problem you experienced and how the problem was resolved.

You’re never too old to enjoy participating in something that you find interesting

Best of luck in the competitions!