Results 1 to 10 of 10

Thread: Application in Terminal?

  1. #1
    Join Date
    Jul 2010
    Location
    Earth, I like it here.
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Wink Application in Terminal?

    Hey all, I want to make a script to run an application in the Terminal. Let's say I want to run minecraft in the terminal with Java 6 runtime.
    /home/onilink422/.minecraft/bin
    and the file inside is
    minecraft.bin
    I know how to make a script, but how do I make the magic happen? any magicians willing to help?
    Yo Way Yo.. Yo Way Yo, Hom Vah Ray, Yo Way Rah; Jerum Brunnen-G..

  2. #2
    Join Date
    Nov 2010
    Location
    India
    Beans
    Hidden!

    Re: Application in Terminal?

    you mean you wanna run that script ?

    Code:
    chmod +X <your_script>.sh
    ./<you_script>.sh
    it will run that script.

    i am not getting that "magic" meaning .

    something else you are expecting ?

    please provide us some more information .
    Dont miss anything even it is small. one small pin is enough to bring down a man.


  3. #3
    Join Date
    Jul 2010
    Location
    Earth, I like it here.
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Application in Terminal?

    I know how to run the script, but I need the actual scriptness. I know how to make an .sh
    Yo Way Yo.. Yo Way Yo, Hom Vah Ray, Yo Way Rah; Jerum Brunnen-G..

  4. #4
    Join Date
    Jan 2008
    Location
    Kerala, India
    Beans
    215
    Distro
    Ubuntu Development Release

    Re: Application in Terminal?

    Just make a file and save it as .sh
    Content of file is the command to run your application

  5. #5
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Application in Terminal?

    I'm a little confused as to what you want to do (but I've also never run minecraft before). If you just want to launch an application from the Terminal, you just have to type the name (assuming the binary is located in a path that's part of your $PATH variable).

    If you've compiled it to another directory, then all you need to do is to make sure the executable is set to be executable (which it seems you already know), and then launch it:

    Code:
    ./pathtoexectuable/minecraft.jar
    I supposed you could create a script to save you from typing the above like:

    Code:
    #! /bin/bash
    /pathtoexectuable/minecraft.jar start
    You could also add an alias to your .bashrc file (which may be smarter depending on just what you want).

  6. #6
    Join Date
    Jul 2010
    Location
    Earth, I like it here.
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Application in Terminal?

    Quote Originally Posted by Vishnu V View Post
    Just make a file and save it as .sh
    Content of file is the command to run your application
    Sad that many people do not know how to read. I already said I needed the script! I know how to make an .sh script, but I needed the actual scripting. o.O

    Anyway, thanks drmrgd, that helped a lot.


    btw this is my script.

    #! /bin/bash
    cd onilink422/.minecraft/bin/
    java -jar minecraft.jar
    Thnaks again, drmrgd, you are amazing
    Last edited by onilink422; February 9th, 2012 at 11:19 PM.
    Yo Way Yo.. Yo Way Yo, Hom Vah Ray, Yo Way Rah; Jerum Brunnen-G..

  7. #7
    Join Date
    Apr 2010
    Beans
    498
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Application in Terminal?

    Well, if you want to make a script for running a Java program, you must code something like this in your script

    Code:
    java -jar jar_file.jar
    In case you want to run the program with a different JRE than the system uses by default, then you should code

    Code:
     /path_to_the_specific_jre/java -jar jar_file.jar
    I hope this helps you out.
    Bad command. Bad, bad command! Sit! Stay! Staaaaay!!!.

  8. #8
    Join Date
    Oct 2009
    Location
    Elgin, IL USA
    Beans
    3,267
    Distro
    Ubuntu 16.10 Yakkety Yak

    Re: Application in Terminal?

    I could be wrong, but I believe you are attempting to run the wrong minecraft.jar. Typically you need to run the minecraft.jar with the launcher that you downloaded originally (version should not matter, just that it is a release version that includes the launcher). That is what logs you in and runs (or creates if non-existing) the minecraft.jar in ~/.minecraft/bin/

    I don't think the one in ~/.minecraft/bin includes a launcher, at least I know it does not in prerelease snapshots.

    Also if you create a bin directory in your home directory (~/bin), once you log out and log back in once, put any scripts there and that bin will automatically be in your $PATH, so you will not need to use ./ prefix.

    Don't forget to chmod u+x scriptname to give any new scripts execute permission.

    The script I use is:

    Code:
    #!/bin/sh
    # Change cd line to your path to orig minecraft.jar, NOT ~/.minecraft/bin
    cd ~/Downloads
    java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame
    The example on minecraft.net is incorrect as it shows Minecraft.jar when the download is minecraft.jar (Linux filenames are case sensitive).
    Last edited by efflandt; February 10th, 2012 at 12:05 AM.
    i5 650 3.2 GHz upgraded to i7 870, 16 GB 1333 RAM, nvidia GTX 1060, 32" 1080p & assorted older computers

  9. #9
    Join Date
    Oct 2011
    Location
    ZZ9 Plural Z Alpha
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Application in Terminal?

    Quote Originally Posted by onilink422 View Post
    Sad that many people do not know how to read.
    This comes across as unnecessarily belligerent. Keep in mind that these are people volunteering to help you.

    Quote Originally Posted by onilink422 View Post
    I already said I needed the script! I know how to make an .sh script
    If this is the case, you DO NOT know how to make a script, you know how to create a file and give it a .sh extension. Be clear.

    If you just want to run a .jar file, it would be as simple as

    Code:
    #!/bin/bash
    java -jar /pathtojar/my_jar.jar
    That's it. Save that in your /bin folder (you'll need sudo permissions to do that) after making it executable as shown above.

  10. #10
    Join Date
    Jul 2010
    Location
    Earth, I like it here.
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Application in Terminal?

    Quote Originally Posted by cortman View Post
    This comes across as unnecessarily belligerent. Keep in mind that these are people volunteering to help you.



    If this is the case, you DO NOT know how to make a script, you know how to create a file and give it a .sh extension. Be clear.

    If you just want to run a .jar file, it would be as simple as

    Code:
    #!/bin/bash
    java -jar /pathtojar/my_jar.jar
    That's it. Save that in your /bin folder (you'll need sudo permissions to do that) after making it executable as shown above.

    I DO know how to make a script, sir I have been doing it for years. I just couldn't get this one to execute properly because I realized I was using the wrong extention, I was inserting a .bin instead of a .jar file as my sun java launcher. Yes, I am very experienced with .sh scripting. I just couldn't figurer out why it wasn't working. I agree I could have been a little more clear, so that is my fault.
    I wonder why people make assumptions about people they know nothing about?
    Last edited by onilink422; February 10th, 2012 at 01:01 AM.
    Yo Way Yo.. Yo Way Yo, Hom Vah Ray, Yo Way Rah; Jerum Brunnen-G..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •