#How can I add Java to an existing Python project?

12 messages · Page 1 of 1 (latest)

solar lance
#

Hey folks! I have a .jar file that I am trying to call from my python (Fastapi) project — it's not a great setup but there's no way around it. I tried using the beta feature "providers" to add Java, but I believe that's just for building the app. Does anyone have any ideas on how to get this to work?

coral citrusBOT
#

Project ID: 823ace55-3f7f-426a-827e-13063872144b

solar lance
#

823ace55-3f7f-426a-827e-13063872144b

jolly basin
#

Try setting that variable to jdk

#

We’ll make this more UI driven/better over the next bit but that’s how it is for now

solar lance
#

Awesome thank you Cooper! That would go in a railway.toml file, correct? Does the railway.toml override my existing build/run commands? i.e. do I have to specify just the NIXPACKS_LIB in the toml or any existing settings I have in the GUI as well?

jolly basin
#

You can just add it to the Variables in the service

solar lance
#

Ah I see, thank you!

#

Hey Cooper, I added the env var:NIXPACKS_LIBS with a value of jdk In the build logs, there are two lines referencing jdk: ```#8 17.50 /nix/store/500hgnsk77cs40fmhmq3hv47kyvfaq69-openjdk-17.0.4+8
#8 46.28 copying path '/nix/store/500hgnsk77cs40fmhmq3hv47kyvfaq69-openjdk-17.0.4+8' from 'https://cache.nixos.org';...

However, I still get the same Python error in the deploy logs:
```FileNotFoundError: [Errno 2] No such file or directory: 'java'```
Any ideas?
jolly basin
#

Try doing NIXPACKS_LIBS instead of PKGS?

solar lance
#

That got it, thanks Cooper!