---
title: "Solutions to problems with Java Development"
date: 2024-05-12T20:03:17-04:00
tags: ['Java', 'software development', 'Neovim']
---

I recently ran into some problems with java development.
One problem was neovim specific but the other was an issue with gradle. 
I wanted to document these in case any one else has similar problems as it took me a little bit of time to figure out.

## Problem 1: jdtls exiting with status code 13

I use jdtls through Mason with the built in nvim LSP and was recently having an issue where jdtls would immediately crash when opening a file. 
The solution to this problem was just deleting the cache for jdtls:

```sh
rm ~/.cache/jdtls
```

**Edit 05/14/2024**: This also solves the problem of jdtls not attaching on neovim startup.
May solve other problems as well, so should be first thing to try if jdtls isn't working.

## Problem 2: Could not set executable permissions for .gradle

When attempting to build with a gradlew script I was running into the following error:

*Could not set executable permissions for: ~/.gradle/wrapper/dists/gradle-7.6-bin/9l9tetv7ltxvx3i8an4pb86ye/gradle-7.6/bin/gradle*

After spending some time trying to find a solution, I found a suggestion of setting an environment variable:

```sh 
 export JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork"
```

The above environment variable was all I needed and the gradle script was able to assemble the project successfully.
Hopefully this is helpful to someone!




