Results 1 to 3 of 3

Thread: Java in a batch file being run via a VB program.

  1. #1

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057

    Java in a batch file being run via a VB program.

    I know nothing of Java I asked a fellow programmer about this problem I have been messing with and he suggested I try in the Java area (I origonaly posted in the VB area). Please check this out and see if you have any ideas:
    http://www.vbforums.com/showthread.p...hreadid=209827

    the gist of it is as follows
    Originally posted by me
    I'm not to sure how this batch file works (basicly it is contacting another co's server and transfering files) but I believe it is through java. I control it via the command window. Will it be hard or even possible to convert to vb?


    code:--------------------------------------------------------------------------------
    echo off
    rem set JDK_BIN=D:\jdk\bin\
    SET CLASSPATH=D:\blahxf\java;D:\Blahxf\lib\email.jar;D:\Blahxf\lib\jnet.jar;D:\Blahxf\lib\foo.jar
    SET CLASSPATH=%CLASSPATH%;D:\Blahxf\lib\jsse.jar;D:\Blahxf\lib\jcert.jar
    JAVA -Xms8M com.Blah.interfaces.pms1way.BlahClient -S Y
    --------------------------------------------------------------------------------
    Originally posted by PhilRob56
    Recently I came across a nice VB Class module that executes a DOS command and captures the output to any control (textbox / label) that you like. The good thing about it is that it uses the API to execute the DOS command and therefore you don't get the DOS window - the whole process is invisible.

    I use it to read the EXIF data from digital camera files, because the program I have to extract the data is a command line program only.

    If you want it let me know and I will post it for you.
    Originally posted by me
    the batch file is in a directory on d: and has to be there (I may be able to fix it if I have to but wont be fun ) and I believe the exe has to be in the root of c:. easy right just do this:
    d:
    cd theDirectory
    theBatch.bat

    but the d: (and anything but "help" or the batch name) gives the error:


    quote:
    --------------------------------------------------------------------------------

    File or command not found.

    --------------------------------------------------------------------------------
    I tried (to first switch to the d: directory):


    visual basic code:--------------------------------------------------------------------------------
    objDOS.CommandLine = "d:"
    objDOS.ExecuteCommand
    --------------------------------------------------------------------------------

    and

    visual basic code:--------------------------------------------------------------------------------
    temp = "d:"
    objDOS.CommandLine = """" & temp & """" 'txtCommand.Text
    objDOS.ExecuteCommand
    --------------------------------------------------------------------------------

    both gave that same error

    I can go to the batch file directly like so:


    code:--------------------------------------------------------------------------------
    d:\theDirectory\Thebatch.bat
    --------------------------------------------------------------------------------

    and it will run but it has its own error cos it cannot find the files it needs (I may have to just edit it but won't be fun)
    OR
    I wote a batch file containg this:

    code:--------------------------------------------------------------------------------
    d:
    cd theDirectory
    theBatch.bat
    --------------------------------------------------------------------------------

    now if I run that batch file from the command window it works perfectly but in the program I have the problem where the exe will show up in the task manager but not really run.

    any ideas?
    Originally posted by me
    I just ran the batch with the full path again and this is the error I get:


    quote:
    --------------------------------------------------------------------------------

    C:\>echo off
    SrmsPms1WayClient initialized at Tue Nov 05 14:47:34 CST 2002
    SrmsPMSSettings.properties not found! Using default values.
    java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at com.bLaH.interfaces.pms1way.SrmsPMSSettings.getServerPort(SrmsPMSSettings.java:163)
    at com.bLaH.interfaces.pms1way.SrmsPMSSettings.setupUrl(SrmsPMSSettings.java:387)
    at com.bLaH.interfaces.pms1way.SrmsPMSSettings.<init>(SrmsPMSSettings.java:87)
    at com.bLaH.interfaces.pms1way.SrmsPms1WayClient.main(SrmsPms1WayClient.java:89)
    Exception in thread "main"

    --------------------------------------------------------------------------------
    Thanks,
    Michael
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I don't know about the batch problem, but the error of the Java app is a NumberFormatException, this means it comes from trying to convert a String that does not contain a number to a number.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    That is probably because of it not finding the 'settings' file...
    SrmsPMSSettings.properties not found! Using default values.
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

Posting Permissions

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



Click Here to Expand Forum to Full Width