Executing GUI .sh file with Osx - terminal

I'm a very beginner in this kind of stuff so I suppose the solution for this problem may not be so difficult.
I'm trying to open the GUI file of MEKA (an extension to weka) and it's manual tells me to execute a file called: run.sh.
I go to the console and type 'my file's location'/run.sh and what happens is I get the message: "The main class could not be located and loaded", or something like that.
This is the content of the run.shfile:
#!/bin/bash
MEMORY=512m
MAIN=meka.gui.explorer.Explorer
java -Xmx$MEMORY -cp "./lib/*" $MAIN $1
So any tips?
Thank you.

The script depends on it being run from the folder it resides in. Try:
cd fileLocation
./run.sh

Related

How to create a script automating CMD(command prompt) and line of commands

I would like to create a shell script that automatically open the CMD and type 2 lines of command
This is the herierchy
open CMD
Change directory (cd d:\mydirectory\drivers
command ( file.exe start -c )
I tried some examples in the existing posts but it has different ways like editing regedit/run at start up..
What I need is to create a executable file wherein if I click it, it will automatically open cmd and type those commands.
I am not also familiar nor knowledgeable in creating shell scripts.
Hope someone will help. Thank you in advance.
Why do you need to specifically open CMD?
Just create a file, call it script.sh, as follows:
#!/bin/bash
cd d:\mydirectory\drivers
file.exe start -c
Save the script and to make it executable, run chmod +x script.sh
Now, you can run it by just clicking on it.
Alright, I found a solution already. Thank you very much for your time.
I just put these command (step-2 and 3) in notepad
then save as textfile.cmd

I Cant get Ruby Packer to work and need a method to package a Ruby application

I have a ruby script that I run from the terminal, however I want to be able to double-click an icon like I would an application and run the script. I've looked at ruby-packer, but it isn't working for me.
What is the best option to accomplish this?
Im on a mac.
In terminal, I'm not at the directory of the .rb file because when I try to run ./rubyc from the directory containing the .rb file, I get the error command not recognized
When I run ./rubyc /RubyProjects/signOff.rb /signOff.out I'm able to get it to run, but the outfile file is called rubyc that just re-runs the same code when I double-click it. I'm at a loss for how to get it to work properly.
`
The -o parameter defines the output filename:
rubyc -o signOff signOff.rb

Running python script on CMD which uses a folder to output results

I was using Pycharm as my editor to run the scripts since i need to add a task scheduler i had to test the code on the command prompt. Firstly this is the structure of my project.
When i try to run the following line
C:\Users\My_name\AppData\Local\Programs\Python\Python36-32\python.exe "C:\Users\My_name\PycharmProjects\FYP_CB006302\generateSummary.py"
I get this error,
From the knowledge i have i think it is because it doesn't recognize the path.
But when i change the directory to my project folder then give the path to python.exe and type generateSummary.py it works which was done as shown here.
However i highly doubt that this method can be used to task a schedule in Windows. Therefore, any ideas that would to run as shown in the beginning will be helpful.
The problem here is that when you use that line to run a particular script the folder which is causing the error is out of scope.
C:\Users\My_name\AppData\Local\Programs\Python\Python36-32\python.exe "C:\Users\My_name\PycharmProjects\FYP_CB006302\generateSummary.py"
In this case pickle_saves folder is out of scope. You can avoid this by giving a absolute path to that file in line 173. Where the absolute path is something like C:\user\documents\projects\pickle_saves\all_words

Explanation Bash Command ${PATH}:

To make shortcut for command line function to make it available everywhere in my mac i usually add this line in ~/.bash_profile
To include one terminal execution file, i usually use: alias yiic='~/Script/Yii/1.1.13/yiic'
yiic is terminal execution file.
And then now i have example this from another site: export PATH=${PATH}:/development/sdk/android-sdk-macosx/tools
I understand this command like import all execution file in tools directory, but what is the meaning of ${PATH}: ?
${PATH} is the other folders that your computer will look in. It's automatically set up by your OS. If you do the following command in your Terminal, you'll see all the folders your computer looks in:
echo $PATH

How To Add A Script To Add Functionality To the Terminal?

I have a small perl script ( found here ) which adds command line functionality to an application I already have installed, Coda. Basically it will open a file with the application when I type:
coda filename.py
Where (on OSX) do I need to put this file to make it function? Do I need to do anything else to my environment to get this working?
Type echo $PATH at the terminal. You will get back a series of paths separated by colons. The file needs to be placed into one of those folders. The file also needs to have the execute flag set, which is done with the chmod tool.

Resources