Run Java Project from Ubuntu Terminal?trouble using a scheduled task to run a shell script (ubuntu linux)How...

How old can references or sources in a thesis be?

"You are your self first supporter", a more proper way to say it

Is there a name for fork-protected pieces?

Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?

What is the word for reserving something for yourself before others do?

Perform and show arithmetic with LuaLaTeX

Replacing matching entries in one column of a file by another column from a different file

I'm flying to France today and my passport expires in less than 2 months

What's that red-plus icon near a text?

What does "Puller Prush Person" mean?

Does detail obscure or enhance action?

What typically incentivizes a professor to change jobs to a lower ranking university?

Can I ask the recruiters in my resume to put the reason why I am rejected?

Is it legal for company to use my work email to pretend I still work there?

Can you really stack all of this on an Opportunity Attack?

Which country benefited the most from UN Security Council vetoes?

Find the result of this dual key cipher

Can I make popcorn with any corn?

Did Shadowfax go to Valinor?

Why can't we play rap on piano?

Why doesn't H₄O²⁺ exist?

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

strTok function (thread safe, supports empty tokens, doesn't change string)

What's the output of a record needle playing an out-of-speed record



Run Java Project from Ubuntu Terminal?


trouble using a scheduled task to run a shell script (ubuntu linux)How to install java on linux without using RPM?Clearing Terminal in UbuntuHow do I make cron run a Java GUI application?Oracle Java Ubuntu Installation - Javac not functioningMac - Run java program at launchUnexpected behavior when using screen with init.dForce Ubuntu user to use specific shellShell script prompt after java connectionRun command after opening terminal window from script using bash






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have a small java project that handle connections.
In order to run it from the terminal I have to cd into the folder that contains the source and run the following command:



java -cp classes com.packagename.mainclass


Where classes is the folder that contains the classes.



I want ubuntu to run this application on startup, is there a Java command I can use? Or am I just better off creating a shell script?



Thanks!










share|improve this question














bumped to the homepage by Community 21 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    1















    I have a small java project that handle connections.
    In order to run it from the terminal I have to cd into the folder that contains the source and run the following command:



    java -cp classes com.packagename.mainclass


    Where classes is the folder that contains the classes.



    I want ubuntu to run this application on startup, is there a Java command I can use? Or am I just better off creating a shell script?



    Thanks!










    share|improve this question














    bumped to the homepage by Community 21 hours ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1


      1






      I have a small java project that handle connections.
      In order to run it from the terminal I have to cd into the folder that contains the source and run the following command:



      java -cp classes com.packagename.mainclass


      Where classes is the folder that contains the classes.



      I want ubuntu to run this application on startup, is there a Java command I can use? Or am I just better off creating a shell script?



      Thanks!










      share|improve this question














      I have a small java project that handle connections.
      In order to run it from the terminal I have to cd into the folder that contains the source and run the following command:



      java -cp classes com.packagename.mainclass


      Where classes is the folder that contains the classes.



      I want ubuntu to run this application on startup, is there a Java command I can use? Or am I just better off creating a shell script?



      Thanks!







      linux ubuntu java boot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 28 '11 at 11:18









      Christopher GwilliamsChristopher Gwilliams

      1,175389




      1,175389





      bumped to the homepage by Community 21 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 21 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          On system boot:



          Add to the end of /etc/rc.local:



          (cd ~your_username/path_to_source/ && sudo -u your_username java -cp ...) &


          (It might be better to create an Upstart job instead.)



          On logon:



          Open "System - Preferences - Startup Programs" (gnome-session-preferences) and add your program there.






          share|improve this answer
























          • Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

            – Christopher Gwilliams
            Apr 28 '11 at 13:52











          • @Christopher: But you can add the java command.

            – grawity
            Apr 28 '11 at 14:08












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f276409%2frun-java-project-from-ubuntu-terminal%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          On system boot:



          Add to the end of /etc/rc.local:



          (cd ~your_username/path_to_source/ && sudo -u your_username java -cp ...) &


          (It might be better to create an Upstart job instead.)



          On logon:



          Open "System - Preferences - Startup Programs" (gnome-session-preferences) and add your program there.






          share|improve this answer
























          • Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

            – Christopher Gwilliams
            Apr 28 '11 at 13:52











          • @Christopher: But you can add the java command.

            – grawity
            Apr 28 '11 at 14:08
















          0














          On system boot:



          Add to the end of /etc/rc.local:



          (cd ~your_username/path_to_source/ && sudo -u your_username java -cp ...) &


          (It might be better to create an Upstart job instead.)



          On logon:



          Open "System - Preferences - Startup Programs" (gnome-session-preferences) and add your program there.






          share|improve this answer
























          • Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

            – Christopher Gwilliams
            Apr 28 '11 at 13:52











          • @Christopher: But you can add the java command.

            – grawity
            Apr 28 '11 at 14:08














          0












          0








          0







          On system boot:



          Add to the end of /etc/rc.local:



          (cd ~your_username/path_to_source/ && sudo -u your_username java -cp ...) &


          (It might be better to create an Upstart job instead.)



          On logon:



          Open "System - Preferences - Startup Programs" (gnome-session-preferences) and add your program there.






          share|improve this answer













          On system boot:



          Add to the end of /etc/rc.local:



          (cd ~your_username/path_to_source/ && sudo -u your_username java -cp ...) &


          (It might be better to create an Upstart job instead.)



          On logon:



          Open "System - Preferences - Startup Programs" (gnome-session-preferences) and add your program there.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 28 '11 at 12:19









          grawitygrawity

          243k37512570




          243k37512570













          • Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

            – Christopher Gwilliams
            Apr 28 '11 at 13:52











          • @Christopher: But you can add the java command.

            – grawity
            Apr 28 '11 at 14:08



















          • Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

            – Christopher Gwilliams
            Apr 28 '11 at 13:52











          • @Christopher: But you can add the java command.

            – grawity
            Apr 28 '11 at 14:08

















          Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

          – Christopher Gwilliams
          Apr 28 '11 at 13:52





          Can you add a java program to Startup programs, I assume it needs to be compiled to a JAR first?

          – Christopher Gwilliams
          Apr 28 '11 at 13:52













          @Christopher: But you can add the java command.

          – grawity
          Apr 28 '11 at 14:08





          @Christopher: But you can add the java command.

          – grawity
          Apr 28 '11 at 14:08


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f276409%2frun-java-project-from-ubuntu-terminal%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...