# \[SOLVED\] Problem running exported jar on linux

**URL:** <https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672>\
**Category:** Project Guidance\
**Created:** [August 15, 2018, 10:43pm UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672 "2018-08-15T22:43:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/simj/32/1130_2.png) [@SimJ](https://discourse.processing.org/u/SimJ)\
**Post date:** [August 15, 2018, 10:43pm UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/1 "2018-08-15T22:43:48Z")

</div>

Hi,

I exported my sketch for linux successfully, but I can’t find a way to run it now.  
I got 4 folders after the export, for different architectures, the one interesting me being application.linux64. It contains a folder ‘lib’, a folder ‘source’ and a shell script ‘MySketch’.  
Here is what I tried so far :

- Double click on ‘MySketch’ : nothing happens.
- Running `java -cp MySketch.jar:core.jar MySketch` in a terminal from the ‘lib’ folder, as explained by PhiLho [here](https://forum.processing.org/one/topic/getting-processing-to-export-as-a-executable-jar.html) : I get the following output

```auto
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 10
	at java.lang.String.checkBoundsBeginEnd(java.base@9-internal/String.java:3119)
	at java.lang.String.substring(java.base@9-internal/String.java:1907)
	at processing.core.PApplet.<clinit>(PApplet.java:120)

```

- Extracting core.jar and MySketch.jar in a folder then zip it and launch it as a .jar (still explained by PhiLho) : got the same output

Can you help me with this ? Thanks

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [August 16, 2018, 12:52am UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/2 "2018-08-16T00:52:25Z")

</div>

Did you try in a console typing `./mySketch`?

make sure it is marked as executable.

Kf

---

<div class="post-metadata">

**Author:** ![MxFxM](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@MxFxM](https://discourse.processing.org/u/MxFxM)\
**Post date:** [August 16, 2018, 5:32am UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/3 "2018-08-16T05:32:00Z")

</div>

Hi.  
Are you sure your code runs properly?

> [@SimJ](#):
>
> StringIndexOutOfBoundsException

> [@SimJ](#):
>
> at processing.core.PApplet

…looks to me like an error in your code? I might be wrong though.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [August 16, 2018, 7:01am UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/4 "2018-08-16T07:01:45Z")

</div>

Looks like you have Java 9 or 10 as your default Java. Processing will only run on 8. Which OS are you using?

---

<div class="post-metadata">

**Author:** ![SimJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/simj/32/1130_2.png) [@SimJ](https://discourse.processing.org/u/SimJ)\
**Post date:** [August 16, 2018, 7:52am UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/5 "2018-08-16T07:52:12Z")

</div>

@kfrajer `./mySketch` throws the same exception.

@MxFxM No problem in the code when ran from the IDE.

@neilcsmith Indeed I am using openjdk version “9-internal”, on Ubuntu 16.04 and Processing 3.3.7. Is there a simple way to run the sketch with java 8 ? I am not sure I want to go into this kind of settings on my computer.

I exported the sketch with java embedded and it works perfectly !

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [August 16, 2018, 8:48am UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/6 "2018-08-16T08:48:08Z")

</div>

> [@SimJ](#):
>
> Indeed I am using openjdk version “9-internal”, on Ubuntu 16.04

Either uninstall OpenJDK 9 and replace with OpenJDK 8, or install both and use

`sudo update-alternatives --config java`

to switch between which one is used as default.

On Ubuntu 16.04 I would just use OpenJDK 8. OpenJDK 9 tends to break lots of stuff and isn’t really supported upstream any more. Once you upgrade to Ubuntu 18.04 you’ll have the option of OpenJDK 10 going to OpenJDK 11, which will be the next Java LTS (not that that means very much). That still won’t work with Processing … yet!

---

<div class="post-metadata">

**Author:** ![SimJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/simj/32/1130_2.png) [@SimJ](https://discourse.processing.org/u/SimJ)\
**Post date:** [August 16, 2018, 5:02pm UTC](https://discourse.processing.org/t/solved-problem-running-exported-jar-on-linux/2672/7 "2018-08-16T17:02:33Z")

</div>

I installed OpenJDK 8 and used  
`sudo update-alternatives --config java`  
The sketch exported without java embedded now works !

Thanks you for your help 🙂
