thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

make .jar file launch at startup

Thu Nov 15, 2012 6:33 pm

Hey community

I am trying to make a .jar file (JDownloader.jar) launch at startup.

Can anyone tell me a simple way of doing this when it is with a .jar file?

Can I just put a file in /ect/init.d containing something like this:
#! /bin/bash
path to .jar file

Hope you can help me
Thx in advance
/Joe

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: make .jar file launch at startup

Thu Nov 15, 2012 6:47 pm

Code: Select all

java -jar jarfile

Code: Select all

java -help
use full paths, try it, and post any errors you get.
init.d is best for things without a GUI.
Use bashrc (or something) and check for X if you want to autostart a GUI
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Thu Nov 15, 2012 7:25 pm

elatllat wrote:

Code: Select all

java -jar jarfile

Code: Select all

java -help
use full paths, try it, and post any errors you get.
init.d is best for things without a GUI.
Use bashrc (or something) and check for X if you want to autostart a GUI
I'm sorry..maybe you could elaborate that - I'm not that experienced with startupscripts

fabi280
Posts: 17
Joined: Wed May 30, 2012 5:36 am

Re: make .jar file launch at startup

Fri Nov 16, 2012 7:01 am

edit the rc.local
add something like

Code: Select all

cd /path/to/jarFolder/
java -jar JarFile.jar
Should work. But it's not very elegant

User avatar
cave
Posts: 161
Joined: Fri Aug 03, 2012 6:26 am
Location: europe/austria
Contact: Website

Re: make .jar file launch at startup

Fri Nov 16, 2012 9:44 am

Use pyLoad instead of JDownloader!

written in python, there is no Java Virtual Machine necessary, plenty of RAM for other functions available. :))

It's lightweight, nice android control app, and a wonderfull WebInterface for usage remote or on localhost.

And has similar features.
http://cavebeat.blogspot.co.at

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Fri Nov 16, 2012 10:55 am

fabi280 wrote:edit the rc.local
add something like

Code: Select all

cd /path/to/jarFolder/
java -jar JarFile.jar
Should work. But it's not very elegant
thx, I'll try that when I get home.
cave wrote:Use pyLoad instead of JDownloader!

written in python, there is no Java Virtual Machine necessary, plenty of RAM for other functions available. :))

It's lightweight, nice android control app, and a wonderfull WebInterface for usage remote or on localhost.

And has similar features.
I've tried pyload and actually thinks it is rather lightweighted, but I cannot seem to get the autoCaptas to work...or even just to manually enter captas..
Do you got any problem with them?

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Fri Nov 16, 2012 8:04 pm

Hmm

can I just add:

Code: Select all

/media/Raspberry/jdownloader/
java -jar JDownloader.jar
any where in the rc.local?

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Wed Nov 21, 2012 9:29 am

Anyone?

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: make .jar file launch at startup

Wed Nov 21, 2012 1:24 pm

I believe you did it the wrong way round. The path has to be prepended
to the .jar filename , not the java command.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Wed Nov 21, 2012 1:45 pm

ghans wrote:I believe you did it the wrong way round. The path has to be prepended
to the .jar filename , not the java command.
ghans
hmm so like this: /media/Raspberry/jdownloader/JDownloader.jar
java -jar JDownloader.jar

Can I just put it any where in the rc.locale?

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: make .jar file launch at startup

Thu Nov 22, 2012 3:16 am

Code: Select all

/usr/bin/java -jar /media/Raspberry/jdownloader/JDownloader.jar
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

thalastplaya
Posts: 19
Joined: Tue Oct 16, 2012 8:21 am

Re: make .jar file launch at startup

Fri Nov 23, 2012 10:07 am

elatllat wrote:

Code: Select all

/usr/bin/java -jar /media/Raspberry/jdownloader/JDownloader.jar
Where do I put that line?
I just tried to put it in the start of the rc.local-file, and that did not work

vNa5h
Posts: 18
Joined: Wed Sep 11, 2013 1:58 pm

Re: make .jar file launch at startup

Tue Oct 01, 2013 2:30 am

bump...same query

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: make .jar file launch at startup

Sun Oct 06, 2013 8:49 am

Try

Code: Select all

sudo raspi-config
and select "Boot to Desktop".

Then

Code: Select all

touch ~/startjar.sh
chmod +x ~/startjar.sh
nano ~/startjar.sh

add following lines :

Code: Select all

#!/bin/bash
/usr/bin/java -jar /media/Raspberry/jdownloader/JDownloader.jar
Save and exit.

Lastly , follow the instructions here to start the shell script
via LXTerminal + .desktop file :
http://www.raspberrypi.org/phpBB3/viewt ... 91&t=55824


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “General discussion”