I made a simple "journal" program that will open a GUI, prompt for an entry and a few factors, and print this information to a file under the current date. I've written a short bit of java code that does this when run, and I want to use cron to schedule it to run every day.
I also wrote a small script ("javashell.sh") to change to the directory where I have the java code, compile it, and run the java program. Its contents are this:
#!/bin/bash cd /home/otolithic/Desktop/projects; javac Journal.java; java Journal;
(Its so short as to feel pointless but I thought it would be necessary to easily run the program from cron; I'm totally new to Linux so let me know if this is weird or not)
I put it in usr/local/bin so I can just type "javashell.sh" in the terminal and the journal app runs no problem. But when I try to make a cronjob out of this command, I can see in the logs that it's run but no GUI ever pops up to ask for a journal entry like it does when I just run javashell.sh outside of cron.
I've tried (after the minute/hour/etc.):
export DISPLAY=:0 && javashell.sh DISPLAY=:0 javashell.sh env DISPLAY=:0 javashell.sh $DISPLAY=:0 && javashell.sh cd ~/path/to/file && javac Journal.java && java Journal env DISPLAY=:0 && cd ~/path/to/file && javac Journal.java && java Journal
to no effect.
I checked that my display is in fact :0 so the problem isn't that. So why isn't this working?
Edit: also tried env DISPLAY=:0 && cd /home/otolithic/Desktop/projects && javac Journal.java && java Journal