Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

How to make the server run a .jar file that creates a pdf to be viewed by the browser

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make the server run a .jar file that creates a pdf to be viewed by the browser

    OK,
    I've already got the .jar file running. It will work from the command prompt on the server computer. What the .jar does is use several variables that are passed to it to create a new pdf that's stamped with information from the database.

    A hard coded example of the command line looks like this:
    Code:
    c:\windows\system32\java.exe -jar c:\A5Webroot\wfstamp.jar P:\Secured\ReleasedPDF\Workflow\DAVID\N\00006081.pdf C:\A5Webroot\DBW_Downloads\52104-150-951.pdf ADH released
    location of java remains hard coded and so does the location of wfstamp.jar. The location of the P:\ file is a variable and so is the "52104-150-951.pdf" and "released" which are passed from the clients browser.

    So, I was using a version of the code that Steve Wood helped me out with the other day to pass my variables into an .a5w page with a url. The url is
    Code:
    Open_Stamped.a5w?fileloc={File_location}&dnum={dnumber}&status={Status}
    The "Open_Stamped.a5w" page looks like this currently:

    Code:
    dim fileloc AS c
    dim status AS c
    dim dnum AS c
    dim outfile AS c
    
    openfile = fileloc
    
    if file.exists(openfile) = .f.
    ?"<script>alert('file not found');</script>" 
    else
    		outfile = "C:\A5Webroot\DBW_Downloads"+chr(92)+dnum+".pdf"	
    		
    'msgbox("Attempting to Open",filelocation)
    'Run pdf creation 'minimized = .f.' and wait until finished	
    	sys_shell_wait("java -jar C:\MVWorks\wfstamp.jar "+quote(fileloc)+" "+outfile+" "+quote(status),.f.)
    
    response.sendfile(outfile,.t.)
    end if%>
    Anyway, I think my problem may be that the sys_shell_wait doesn't work in the web environment. How do I get this to run on the webserver? Do I have to do something with an ajax callback? What I'm attempting to do is let the user view/download one of our drawings but it must be stamped with the information in case they print it as part of our ISO procedure.

    Any help would be appreciated.

    #2
    Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

    Wouldn't you have to use the fully qualified path:

    sys_shell_wait("java -jar("c:\windows\system32\java.exe -jar ....

    instead of just:

    sys_shell_wait("java -jar ....


    Not ideal to be doing something like this, but I can think of no reason why the sys_shell_wait() should not work on the server, and you've correctly not shown the window.

    I always approach something like this with a hard-coded example of what works, then gradually adjust and test the various pieces until I have what I want. That way if something breaks, you know what it is.
    -Steve
    sigpic

    Comment


      #3
      Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

      Originally posted by Steve Workings View Post
      Wouldn't you have to use the fully qualified path:

      sys_shell_wait("java -jar("c:\windows\system32\java.exe -jar ....

      instead of just:

      sys_shell_wait("java -jar ....


      Not ideal to be doing something like this, but I can think of no reason why the sys_shell_wait() should not work on the server, and you've correctly not shown the window.

      I always approach something like this with a hard-coded example of what works, then gradually adjust and test the various pieces until I have what I want. That way if something breaks, you know what it is.
      Maybe you're right about the fully qualified path, however I did use it and try to hard code it, I just didn't want to put that in my example above. Here it is:
      Code:
      sys_shell_wait("c:\windows\system32\java.exe -jar c:\A5Webroot\wfstamp.jar P:\Secured\ReleasedPDF\Workflow\DAVID\N\00006081.pdf C:\A5Webroot\DBW_Downloads\52104-150-951.pdf ADH released")
      I did try the path I have in the code in my last post and it works from the prompt as well.

      This exact code works fine in the command prompt:
      Code:
      c:\windows\system32\java.exe -jar c:\A5Webroot\wfstamp.jar P:\Secured\ReleasedPDF\Workflow\DAVID\N\00006081.pdf C:\A5Webroot\DBW_Downloads\52104-150-951.pdf ADH released
      I just tried it again to make sure.

      I took the code we used from the desktop version that we have running now and tried to make it work on the server. We are in the process of converting over from desktop to web. I was not the guy that did all the coding and making of the desktop version but I've kind of inherrited the web version since I've worked a small amount with websites.

      If there is a better way of doing this I'm all ears though! I posted about this a while back on the forum and no one else had any ideas so I tried to adapt the code. I'd love to do this a different way but have no idea how.

      Comment


        #4
        Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

        I just tried:
        Code:
        sys_shell_wait("explorer.exe", .T.)
        and that works. It pops up an explorer window. Is there somthing in the security settings of the actual server computer preventing this from working possibly?

        ETA: Also, I can run my java command straight from "run" in the start menu without first opening a command prompt. Could there be a problem with alpha 5 passing "/" or spaces?

        ETA Again: Spaces and "/" aren't a problem either....this works:
        Code:
        sys_shell_wait("C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE http:\\google.com", .T.)
        Last edited by -Jinx-; 10-09-2012, 06:25 PM. Reason: additional info

        Comment


          #5
          Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

          It seems to work with everything other than java.exe. I can't even do sys_shell_wait("C:\windows\system32\java.exe", .T.) or C:\windows\system32\javaws.exe. Something has something against java in general me thinks. I just have no idea where to look. C:\windows\system32\cmd.exe works and it's in the same folder. Whiskey Tango.......?

          Somebody has to have an idea.

          Comment


            #6
            Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

            Foxtrot.

            sys_shell_wait and sys_shell_return work from the web app, just not sys_shell.

            I've used both (wait and return) successfully for a host of ways, and it just has to be a valid character string within. I'm betting it's a permissions issue but I can't say I know how to get around it... you can't do it from a file not in the system32 folder can you?

            Comment


              #7
              Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

              Originally posted by christappan View Post
              Foxtrot.

              sys_shell_wait and sys_shell_return work from the web app, just not sys_shell.

              I've used both (wait and return) successfully for a host of ways, and it just has to be a valid character string within. I'm betting it's a permissions issue but I can't say I know how to get around it... you can't do it from a file not in the system32 folder can you?
              Sure can, see above. It works with internet explorer, even let's me make it go to google all from the .a5w page. Worse yet, it works fine with Java.exe from the command prompt. It just won't work with Java.exe from the .a5w page. This is really frustrating. Foxtrot is right.

              This keeps happening to me. Every time something should work, it doesn't, and then I try to find a workaround for it but that doesn't work either...LOL This one problem is keeping my from going live (on the db side) with this. The rest is by no means finished but once this works we're ISO compliant and can let the users in.

              Like I said earlier, if anyone has a better idea how to stamp a preexisting .pdf drawing with values from the db, I'm all ears.

              Comment


                #8
                Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

                I assume sys_shell_return() doesn't return any useful information?

                Comment


                  #9
                  Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

                  Originally posted by christappan View Post
                  I assume sys_shell_return() doesn't return any useful information?
                  Don't assume with me....LOL I haven't tried that.

                  I'm new to programming with alpha 5. I'm a Manufacturing Engineer and should be programming our robots and CNC machines if anything but somehow I took on this project like an idiot.

                  I'll give it a shot tomorrow since I don't have it setup to run from home or vpn just yet.

                  Comment


                    #10
                    Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

                    I can't get the above to do anything special. Just seems like it doesn't do anything. Is anyone here familiar with some security settings on Windows Server 2003 service pack 2 that might be the cause of this issue?

                    Comment


                      #11
                      Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

                      edit: nevermind. you're trying to run the code on the server. disregard.

                      Comment


                        #12
                        Re: How to make the server run a .jar file that creates a pdf to be viewed by the bro

                        OK,
                        I THINK I found the problem. Through a zillion google searches I finally found someone else who was having a similar issue and evidently this is an problem with 64 bit windows and Java. My previous command will work on 32 bit OS's and I found out that our previous server where we are running the desktop version from is 32 bit. Instead of using "c:\windows\system32\java.exe" I had to use "C:\Program Files\Java\jre6\bin\java.exe". That SEEMS to be working. I have only hard coded it so far though so it remains to be seen if this will all end up working in the end.

                        Talk about an arcane and obscure problem. I can only hope this is indeed my only issue in this area and that someone else will read this to keep them from wasting a day of their lives like I did.

                        UPDATE: My code works too. The only issue I'm still having is that a window pops up with nothing in it. The browser does prompt the user to download the file though so I'll start a new thread with that issue.
                        Last edited by -Jinx-; 10-10-2012, 12:45 PM.

                        Comment

                        Working...
                        X