Running JAVA in Cygwin through bash scriptAdding a folder of jar files to my pathJRE in Kubuntu doesn't allow...

about to retire but not retired yet, employed but not working any more

How were medieval castles built in swamps or marshes without draining them?

Nothing like a good ol' game of ModTen

How do we tell which part of kinetic energy gives rise to temperature?

"There were either twelve sexes or none."

What does "rel" in `mathrel` and `stackrel` stands for?

How many birds in the bush?

What do these commands specifically do?

Have you ever been rejected to board the plane because your passport valid less than 3 months?

Filling a listlineplot with a texture

Talk interpreter

Macro inserted via everypar in obeylines context doesn't see some commands

Rent contract say that pets are not allowed. Possible repercussions if bringing the pet anyway?

Can RMSE and MAE have the same value?

Very slow boot time and poor perfomance

What is the meaning of “these lederhosen are riding up my Bundesliga”?

Handling Disruptive Student on the Autism Spectrum

How to check whether a sublist exist in a huge database lists in a fast way?

Prevent use of CNAME record for untrusted domain

Is gzip atomic?

How to maximize the drop odds of the Essences in Diablo II?

How does encoder decoder network works?

Tipa throwing error because of `implies` and `iff`. Workaround or fix?

Does ostensible/specious make sense in this sentence?



Running JAVA in Cygwin through bash script


Adding a folder of jar files to my pathJRE in Kubuntu doesn't allow me to run .jar fileExecute bash script using CygWinWhen I execute a .run file as <user> it works fine. If I sudo run it, it cannot detect JavaIf I set java bin PATH Dockerfile Jar Command runs but tomcat doesn'tRunning script in cygwin enviromentHave bash script running every min in Cygwin






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I've been encountering a problem with cygwin where I cannot run a jar file with an error that the file cannot be found.



If it were easier i would "translate" the java source in bash, but unfortunately, due to the functionality implemented, there are some quite significant obstacles to achieve this, so I'd have to use the jar file.



Now, I've done a fair amount of research on my part to figure out how to do this, however, I couldn't succeed, and it is mandatory that i use cygwin.



Here's what I'm trying to essentially do:



lockfile="$specialfolder/$passedargument.lock
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar -joption cygpath -w $lockfile`


i also tried with double back-ticks, as follows:



pathtooutfile="${some_other_vars}/${that}_${work}.out"
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar` -joption `cygpath -w $lockfile`


i also tried using the $JAVA_HOME env var but that did not work as well. It is important to mention that the variables being called in lockfile var are defined as follows:



 homedir= "/cygdrive/driveletter/folder/folder"
specialfolder= "$homedir/foler/$passedargument"
passedargument= $1 ###argument passed with execution of bash script
lockfile= "$specialfolder/$passedargument"


The error i keep getting is this: Error: Unable to access jarfile
I have modified usage rights to 777 and that didn't work either. It might also be important to mention that -joption is either -aquire or -release corresponding to the lockfile since one of the things the jar does is manage multiple script executions through a lock file.
I'm somewhat stuck so, any suggestions will be greatly appreciated. I think that this might be more of a cygwin issue.










share|improve this question

















bumped to the homepage by Community 5 hours ago


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

















  • What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

    – EightBitTony
    Mar 10 '16 at 9:22











  • always Error: Unable to access jarfile

    – Nikolai Uzunov
    Mar 10 '16 at 9:45











  • So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

    – EightBitTony
    Mar 10 '16 at 10:16













  • it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

    – Nikolai Uzunov
    Mar 10 '16 at 10:51






  • 1





    Then edit your question with that detail, because right now, that's not what your question is asking.

    – EightBitTony
    Mar 10 '16 at 14:02


















0















I've been encountering a problem with cygwin where I cannot run a jar file with an error that the file cannot be found.



If it were easier i would "translate" the java source in bash, but unfortunately, due to the functionality implemented, there are some quite significant obstacles to achieve this, so I'd have to use the jar file.



Now, I've done a fair amount of research on my part to figure out how to do this, however, I couldn't succeed, and it is mandatory that i use cygwin.



Here's what I'm trying to essentially do:



lockfile="$specialfolder/$passedargument.lock
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar -joption cygpath -w $lockfile`


i also tried with double back-ticks, as follows:



pathtooutfile="${some_other_vars}/${that}_${work}.out"
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar` -joption `cygpath -w $lockfile`


i also tried using the $JAVA_HOME env var but that did not work as well. It is important to mention that the variables being called in lockfile var are defined as follows:



 homedir= "/cygdrive/driveletter/folder/folder"
specialfolder= "$homedir/foler/$passedargument"
passedargument= $1 ###argument passed with execution of bash script
lockfile= "$specialfolder/$passedargument"


The error i keep getting is this: Error: Unable to access jarfile
I have modified usage rights to 777 and that didn't work either. It might also be important to mention that -joption is either -aquire or -release corresponding to the lockfile since one of the things the jar does is manage multiple script executions through a lock file.
I'm somewhat stuck so, any suggestions will be greatly appreciated. I think that this might be more of a cygwin issue.










share|improve this question

















bumped to the homepage by Community 5 hours ago


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

















  • What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

    – EightBitTony
    Mar 10 '16 at 9:22











  • always Error: Unable to access jarfile

    – Nikolai Uzunov
    Mar 10 '16 at 9:45











  • So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

    – EightBitTony
    Mar 10 '16 at 10:16













  • it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

    – Nikolai Uzunov
    Mar 10 '16 at 10:51






  • 1





    Then edit your question with that detail, because right now, that's not what your question is asking.

    – EightBitTony
    Mar 10 '16 at 14:02














0












0








0








I've been encountering a problem with cygwin where I cannot run a jar file with an error that the file cannot be found.



If it were easier i would "translate" the java source in bash, but unfortunately, due to the functionality implemented, there are some quite significant obstacles to achieve this, so I'd have to use the jar file.



Now, I've done a fair amount of research on my part to figure out how to do this, however, I couldn't succeed, and it is mandatory that i use cygwin.



Here's what I'm trying to essentially do:



lockfile="$specialfolder/$passedargument.lock
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar -joption cygpath -w $lockfile`


i also tried with double back-ticks, as follows:



pathtooutfile="${some_other_vars}/${that}_${work}.out"
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar` -joption `cygpath -w $lockfile`


i also tried using the $JAVA_HOME env var but that did not work as well. It is important to mention that the variables being called in lockfile var are defined as follows:



 homedir= "/cygdrive/driveletter/folder/folder"
specialfolder= "$homedir/foler/$passedargument"
passedargument= $1 ###argument passed with execution of bash script
lockfile= "$specialfolder/$passedargument"


The error i keep getting is this: Error: Unable to access jarfile
I have modified usage rights to 777 and that didn't work either. It might also be important to mention that -joption is either -aquire or -release corresponding to the lockfile since one of the things the jar does is manage multiple script executions through a lock file.
I'm somewhat stuck so, any suggestions will be greatly appreciated. I think that this might be more of a cygwin issue.










share|improve this question
















I've been encountering a problem with cygwin where I cannot run a jar file with an error that the file cannot be found.



If it were easier i would "translate" the java source in bash, but unfortunately, due to the functionality implemented, there are some quite significant obstacles to achieve this, so I'd have to use the jar file.



Now, I've done a fair amount of research on my part to figure out how to do this, however, I couldn't succeed, and it is mandatory that i use cygwin.



Here's what I'm trying to essentially do:



lockfile="$specialfolder/$passedargument.lock
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar -joption cygpath -w $lockfile`


i also tried with double back-ticks, as follows:



pathtooutfile="${some_other_vars}/${that}_${work}.out"
java -jar `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar` -joption `cygpath -w $lockfile`


i also tried using the $JAVA_HOME env var but that did not work as well. It is important to mention that the variables being called in lockfile var are defined as follows:



 homedir= "/cygdrive/driveletter/folder/folder"
specialfolder= "$homedir/foler/$passedargument"
passedargument= $1 ###argument passed with execution of bash script
lockfile= "$specialfolder/$passedargument"


The error i keep getting is this: Error: Unable to access jarfile
I have modified usage rights to 777 and that didn't work either. It might also be important to mention that -joption is either -aquire or -release corresponding to the lockfile since one of the things the jar does is manage multiple script executions through a lock file.
I'm somewhat stuck so, any suggestions will be greatly appreciated. I think that this might be more of a cygwin issue.







bash java cygwin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 10 '16 at 9:19







Nikolai Uzunov

















asked Mar 10 '16 at 8:58









Nikolai UzunovNikolai Uzunov

106 bronze badges




106 bronze badges






bumped to the homepage by Community 5 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 5 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 5 hours ago


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















  • What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

    – EightBitTony
    Mar 10 '16 at 9:22











  • always Error: Unable to access jarfile

    – Nikolai Uzunov
    Mar 10 '16 at 9:45











  • So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

    – EightBitTony
    Mar 10 '16 at 10:16













  • it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

    – Nikolai Uzunov
    Mar 10 '16 at 10:51






  • 1





    Then edit your question with that detail, because right now, that's not what your question is asking.

    – EightBitTony
    Mar 10 '16 at 14:02



















  • What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

    – EightBitTony
    Mar 10 '16 at 9:22











  • always Error: Unable to access jarfile

    – Nikolai Uzunov
    Mar 10 '16 at 9:45











  • So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

    – EightBitTony
    Mar 10 '16 at 10:16













  • it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

    – Nikolai Uzunov
    Mar 10 '16 at 10:51






  • 1





    Then edit your question with that detail, because right now, that's not what your question is asking.

    – EightBitTony
    Mar 10 '16 at 14:02

















What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

– EightBitTony
Mar 10 '16 at 9:22





What does cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar return if you run it on its own. (Please add the output to your question, not as a comment).

– EightBitTony
Mar 10 '16 at 9:22













always Error: Unable to access jarfile

– Nikolai Uzunov
Mar 10 '16 at 9:45





always Error: Unable to access jarfile

– Nikolai Uzunov
Mar 10 '16 at 9:45













So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

– EightBitTony
Mar 10 '16 at 10:16







So the command, cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar on its own, with nothing else, gives you that error? Can you copy and paste you typing that command in and the output? In the question. You are using c or d (or something) in place of driveletter, rather than the word driveletter?

– EightBitTony
Mar 10 '16 at 10:16















it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

– Nikolai Uzunov
Mar 10 '16 at 10:51





it gives me the path to the file in unix format, and yes i am using an actual drive letter like "d" for example

– Nikolai Uzunov
Mar 10 '16 at 10:51




1




1





Then edit your question with that detail, because right now, that's not what your question is asking.

– EightBitTony
Mar 10 '16 at 14:02





Then edit your question with that detail, because right now, that's not what your question is asking.

– EightBitTony
Mar 10 '16 at 14:02










2 Answers
2






active

oldest

votes


















0















Have you tried cygpath -w -a .....



The -a returns absolute paths.



e.g.



$ cygpath -w ./screenshot.jpg
screenshot.jpg

$ cygpath -w -a ./screenshot.jpg
C:cygwin64hometonyscreenshot.jpg





share|improve this answer

































    0















    If your expression



    `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar`


    has embedded blanks, you should put double-quotes around it so that the result is passed to Java as a single token. It can help to understand the expressions and results if you turn on the shell trace, e.g., set -x.



    Further reading:




    • cygpath — Convert Unix and Windows format paths, or output system path information

    • Making Cygwin and Windows cooperate






    share|improve this answer






























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f268855%2frunning-java-in-cygwin-through-bash-script%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0















      Have you tried cygpath -w -a .....



      The -a returns absolute paths.



      e.g.



      $ cygpath -w ./screenshot.jpg
      screenshot.jpg

      $ cygpath -w -a ./screenshot.jpg
      C:cygwin64hometonyscreenshot.jpg





      share|improve this answer






























        0















        Have you tried cygpath -w -a .....



        The -a returns absolute paths.



        e.g.



        $ cygpath -w ./screenshot.jpg
        screenshot.jpg

        $ cygpath -w -a ./screenshot.jpg
        C:cygwin64hometonyscreenshot.jpg





        share|improve this answer




























          0














          0










          0









          Have you tried cygpath -w -a .....



          The -a returns absolute paths.



          e.g.



          $ cygpath -w ./screenshot.jpg
          screenshot.jpg

          $ cygpath -w -a ./screenshot.jpg
          C:cygwin64hometonyscreenshot.jpg





          share|improve this answer













          Have you tried cygpath -w -a .....



          The -a returns absolute paths.



          e.g.



          $ cygpath -w ./screenshot.jpg
          screenshot.jpg

          $ cygpath -w -a ./screenshot.jpg
          C:cygwin64hometonyscreenshot.jpg






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 10 '16 at 9:25









          EightBitTonyEightBitTony

          16.9k3 gold badges46 silver badges55 bronze badges




          16.9k3 gold badges46 silver badges55 bronze badges




























              0















              If your expression



              `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar`


              has embedded blanks, you should put double-quotes around it so that the result is passed to Java as a single token. It can help to understand the expressions and results if you turn on the shell trace, e.g., set -x.



              Further reading:




              • cygpath — Convert Unix and Windows format paths, or output system path information

              • Making Cygwin and Windows cooperate






              share|improve this answer
































                0















                If your expression



                `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar`


                has embedded blanks, you should put double-quotes around it so that the result is passed to Java as a single token. It can help to understand the expressions and results if you turn on the shell trace, e.g., set -x.



                Further reading:




                • cygpath — Convert Unix and Windows format paths, or output system path information

                • Making Cygwin and Windows cooperate






                share|improve this answer






























                  0














                  0










                  0









                  If your expression



                  `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar`


                  has embedded blanks, you should put double-quotes around it so that the result is passed to Java as a single token. It can help to understand the expressions and results if you turn on the shell trace, e.g., set -x.



                  Further reading:




                  • cygpath — Convert Unix and Windows format paths, or output system path information

                  • Making Cygwin and Windows cooperate






                  share|improve this answer















                  If your expression



                  `cygpath -w ./cygdrive/driveletter/folder/folder/javafile.jar`


                  has embedded blanks, you should put double-quotes around it so that the result is passed to Java as a single token. It can help to understand the expressions and results if you turn on the shell trace, e.g., set -x.



                  Further reading:




                  • cygpath — Convert Unix and Windows format paths, or output system path information

                  • Making Cygwin and Windows cooperate







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 10 '16 at 9:32

























                  answered Mar 10 '16 at 9:23









                  Thomas DickeyThomas Dickey

                  55.4k5 gold badges112 silver badges190 bronze badges




                  55.4k5 gold badges112 silver badges190 bronze badges

































                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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%2funix.stackexchange.com%2fquestions%2f268855%2frunning-java-in-cygwin-through-bash-script%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

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...