I'm new to bash scripting and cannot find a fix suitable and that I can understand on the web. The problem seems classical but I lost.
I try to make my own command lines I can use directly from a bash terminal on Ubuntu. I use an alternative .bash_profile to make sure to avoid problems with the .bashsr file containing the default bash environment settings. I load my settings with source .bash_profile
I then have my own /bin_onyr directory where I put the .sh scripts in order to make my own commands as well as a script with aliases I want to use and access permissions to the other scripts.
Problem, I get this :
onyr@kenzae:~$ source .bash_profile Welcome Onyr. Pleased to see you again. ʘ gameoflife 10 12 15 Error: Could not find or load main class GameOfLife.class Caused by: java.lang.ClassNotFoundException: GameOfLife.class
I want to transform my java program GameOfLife.class as a command line I can use directly. The program works with and without passed arguments.
onyr@kenzae:~$ cd Documents/computer_sciences/tp_java/10_tp_game_of_life/
onyr@kenzae:~/Documents/computer_sciences/tp_java/10_tp_game_of_life$ java GameOfLife
frameNumber0
. . . . . . . . . . . .
. X . . X . X X . X . .
. . . X . . . . . . X .
. X X X . . . . X . . .
. X . . . X X . . . X .
. X X X . . X X . X . .
. . . . . . . . . . . .
I don't know what to do. Bellow are my scripts. Please help :
.bash_profile in /home/onyr
#This is a personal alternative to the original .bashrc environment settings
echo "Welcome Onyr. Pleased to see you again."
export PS1="ʘ "
#get the aliases for personnal commands
chmod +x ./bin_onyr/bash_aliases_onyr.sh #grant run permission
source ./bin_onyr/bash_aliases_onyr.sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/$
#test
alias greet3="~/bin_onyr/greetings_codecademy.sh 3"
bash_aliases_onyr in /home/onyr/bin_onyr
#!/bin/bash
#grant run permission for shell command line bash files
chmod +x ~/bin_onyr/greetings_codecademy.sh
chmod +x ~/bin_onyr/gameoflife.sh
# This file contains my own command aliases
alias greet3="~/bin_onyr/greetings_codecademy.sh 3" #3 is default value
alias greet="~/bin_onyr/greetings_codecademy.sh" #here there must be an agrument ex: greet 4
alias gameoflife="~/bin_onyr/gameoflife.sh" #the game of life displayed
gameoflife.sh in /home/onyr/bin_onyr
#!/bin/bash
cd /home/onyr/Documents/computer_sciences/tp_java/10_tp_game_of_life/
java GameOfLife.class $@
GameOfLife.class is located in a different directory /home/onyr/Documents/computer_sciences/tp_java/10_tp_game_of_life/