Launchin a jar via .bat

Hello,
I am having trouble launching a jar file from a batch file. I'm running Windows XP Pro 2002. Here is what is in my bat file. It starts the program but it also leaves the dos window active.
Also, Is there a better alternative to using .bat files?
echo off
cd\JavaJeff\Java Jre\jre\bin\
java -jar calculatortwo.jarThank you.

The reason I tried to change dir is because the 'prompt' just flashes on and off quickly when I execute the batch file, and that's it. So I added a pause to the .bat to get a glimpse and It seemed to me that the jar file was not found. Then I tried the cd and it worked.
When I run the batch file as you have suggested I get the same behavior, just a quick flash.
Now, why doesn't it work the way you suggested. I would like to understand all of this. By the way I changed the bin;%PATH% to bin:%PATH% .
Thanks

Similar Messages

  • Import Pickup Group Members via BAT?

    Hey guys,
    I'm a little bit confused, but is there any way to import group members via BAT into existing pickup groups???
    Unfortunately my colleague already created the groups but he didn't insert the members at all.
    I'm talking about 200 groups with different parameters and I have to insert over 2000 members. So I wonder about how to import.
    Please gimme a hint.
    Thanks                  

    Hi Patrick,
    Yes you can add lines with this option on bat excel sheet
    Call   Pickup Group 1
    [String[50]OPTIONAL]
    Regards
    Haitham

  • Loading an entire JAR via a classloader

    Hi how would I load an entire JAR file via a classloader. Currently I'm able to load one file at a time (in this case org.w3c.dom.Node) as shown below:
    import java.net.*;
    public class MyJarLoader {
       public static void main(String [] args) throws Exception {
         URL[] urlsToLoadFrom = new URL[]{new URL("file:subdir3/xml-apis.jar")};
         URLClassLoader loader1 = new URLClassLoader(urlsToLoadFrom);
         Class cls1 = Class.forName("org.w3c.dom.Node", true, loader1);
         System.out.println("Loaded '"+cls1.getName()+"'");
         org.w3c.dom.Node Node = (org.w3c.dom.Node) cls1.newInstance();
    Thanks

    Figured this one out as below. Note this is the simplistic solution since it requires that the jar files be present in the classpath. If not, you will have to write your own loadClass method to read the data from the zip (& then can't use the method 'Class.forName()').
    Regards
    //Load Apache JAR files
    URL[] urlArrToLoadFrom = new URL[]{new URL("file:xalan-j_2_5_0/xml-apis.jar"),
                new URL("file:xalan-j_2_5_0/xercesImpl.jar"), new URL("file:xalan-j_2_5_0/xalan.jar")};
    //Create a URLClassLoader to access jar files
    URLClassLoader urlLoaderGeneric = new URLClassLoader(urlArrToLoadFrom);
    //Foreach jar file, open, load class files & close
    for(int i=0; i<urlArrToLoadFrom.length; i++) {
    //Debug
       System.out.println(urlArrToLoadFrom.toString());
       //Open zip file
       ZipFile zf = new ZipFile(urlArrToLoadFrom[i].getFile());
       for (Enumeration enum = zf.entries(); enum.hasMoreElements();) {
         //Get entry
         ZipEntry ze = (ZipEntry) enum.nextElement();
         //Only load if it's not a directory and it's a class file
         int iIndexClass = -1;
         if (!ze.isDirectory() && ((iIndexClass = ze.getName().indexOf(".class")) != -1)) {
             //Remove .class & replace / with .
             String strApacheClassName = (ze.getName().substring(0,iIndexClass)).replace('/','.');
             //Load class file
             Class classApache = Class.forName(strApacheClassName, true, urlLoaderGeneric);
             System.out.println("Loaded '"+classApache.getName()+"'");
       //Close zip
       zf.close();

  • Loading a jar via a custom classloader

    Hi,
    I have written a custom class loader that allows me to load a compiled java program as a collection of class files at runtime.
    This is nice however I now need to consider the runtime execution of more complex java programs that have custom library dependencies.
    This means loading a .jar library into the classloader. I can get the contents of a jar and load specific classes by name via reflection but I want to load the entire jar into the classloader so that its contents can be used 'as needed' much like a jar on the system classpath.
    Is this possible? If so I would like to know how as I have been struggling with this problem and cannot see a solution.
    Regards,
    Stephen

    However I still don't understand why you need to
    actually load all those classes initially. Afterall,
    URLClassLoader (which sounds a lot like what youare
    describing) only loads classes as needed.i have just built a swing app that accesses an oracle
    database, i jared together all the classes, and i did
    something in the manfest file so that you can just
    double clisk the jar and it fires up like an exe.
    doing it this way everything is fine except it cannot
    access the database, the reason is those oracle
    classes are not loaded, even they are on the path - i
    can run the app using a batch file but i dont like it
    as it opens up a dos window. this is an example, as i
    was told, where it is necessary to load all thoses
    oracle database classes initially. Dear, daFei.
    I believe that you are getting confused between the way the system will ignore that CLASPPATH environment variable when you run a java application packaged as a jar file with the -jar switch (the classpath for the jar can be set in the manifest) and what I am attempting to-do which is to run a compiled java program at runtime and dynamically load any dependant libraries.
    Stephen

  • Stopping/Starting Portal via BAT file on Windows

    In our landscape we have the ABAP and JAVA stack installed on separate servers for security reason.  We are trying to implement windows updates via SUS and need to automate the stopping and starting of SAP.  The bat file that was created works when stopping and starting the ABAP portion of SAP but on the Portal server it will take it down but when trying to start Portal, the J2ee Server will not start, but when I use the SAP MMC all servers starts up without any problem.  Below is the start up bat file, any assistance will be greatly appreciated:
    REM start of script
    PATH=%path%;G:\usr\sap\QBE\SYS\exe\uc\NTAMD64
    SET ORACLE_SID=QBE
    SET SAPDATA_HOME=K:\ORACLE\QBE
    REM
    REM
    REM ***** starting Oracle Services *****
    REM
    net start OracleQBE102TNSListener
    net start OracleServiceQBE
    net start OracleQBE102iSQL*Plus
    REM
    REM ***** starting SAP services *****
    REM
    net start SAPOsCol
    net start SAPQBE_00
    net start SAPQBE_01
    REM
    REM ***** starting SAP Instances ******
    REM
    G:\usr\sap\QBE\SYS\exe\uc\NTAMD64\startsap.exe name=QBE nr=00 SAPDIAGHOST=SAPEPQA
    G:\usr\sap\QBE\SYS\exe\uc\NTAMD64\startsap.exe name=QBE nr=01 SAPDIAGHOST=SAPEPQA
    REM
    REM end of script

    I looked up some training material and in TADM10 - Unit4 - Starting and Stopping a SAP NetWeaver AS Java.. the following is stated:
    Under Windows, the SAP system can also be started and stopped without a GUI by
    calling a command by means of the executable files startsap.exe and stopsap.exe. This
    can be done using a simple telnet access.
    To start an instance of the SAP system, open a telnet connection and enter the
    following command: startsap name=<SID> nr=<instance nr.>
    SAPDIAHOST=<hostname>
    To stop an instance of the SAP system, open a telnet connection and enter the
    following command: stopsap name=<SID> nr=<instance nr.>
    SAPDIAHOST=<hostname>
    For the SAPDIAHOST parameter, enter the name of the host on which the instance is
    to be started.
    So the script is correct, its all according to SAP advice... very strange

  • Printing solo PDFs via .BAT file

    Hi all,
    We have a current implementation of Oracle Documaker for our LOB. What we do is run a .BAT file that runs the GEN* brothers (gentnw32, gendaw32, and genptw32). This then uses the XML defined in the DATA segment of the fsisys INI file. This prints out multiple PDFs for us depending on the contents of the XML.
    We have a new requirement that states that we need to be able to print a solo PDF using an XML file that is found in a different directory, with a different file name, say invoice1085.xml. Is there a way to do this? I cannot edit the current setup of the workspace since the batch process needs to stay.
    We are using Documaker Studio Version 12.2.0.21451 Build Aug 8 2013. The workspace however was created with an older version (uses an MRL files rather than an ODBC connection)

    Hi,
    I need to pass the extract file name to the GEN Programs via JAVA. Also, my batch file only has the lines:
    SET BASEDIR=%cd%
    CD %BASEDIR%\DATA
    Echo Y|Del *.* >NUL
    cd..
    gendaw32 /ini=fsiuser.ini
    genptw32 /ini=fsiuser.ini
    pause
    del .\print\_*.pdf
    del .\print\.pdf
    pause
    :Exit
    Or
    echo
    gentnw32
    pause
    gendaw32
    pause
    genptw32
    pause
    I'm sorry. I'm not very familiar with creating .BAT files or executables. Would "set MYEXTRACT=%1" replace the "ExtrFile           = INPUT\extrfile.xml" line in my fsisys.ini file? Or will it only stick for the current run? Thanks a lot. I'll try experimenting with your suggestion.
    EDIT: I got it to work using your suggestion but instead of using "Extract = ~GETENV MYEXTRACT", I used "ExtrFile           = ~GETENV MYEXTRACT". Thanks a bunch!

  • How to send jar via BT in 3110c?

    How can I send jar files from 3110c to another phone via bluetooth?

    There is Java application available although not certain whether you need to purchase after trial:
    http://www.medieval.it/installation-instructions/menu-id-98.html
    Happy to have helped forum with a Support Ratio = 42.5

  • Problems with libs in jar and .bat file

    I have a third party library in a jar, let's say LIBRARY.JAR. Then I have my program which uses classes in that Jar, let's call it Program.JAR. The main class is program.Main.class. And I want to write a batch file so that it set's the classpath ro the LIBRARY.JAR, and runs program.Main class. Could anybody help me? I can't manage so far...

    For Windows the batch file could containjava -classpath LIBRARY.JAR;Program.JAR program.MainFor *nix, use : instead of ;                                                                                                                                                                                                                                                                       

  • Error Installing xmlplsql.jar via patch 1453927

    Hi,
    I am new to this XML piece of Oracle Applications. We are currently upgrading from 10.7 to 11.5.8. We finished the AutoUpgrade and are on the 11i Post Upgrade step. It appears the first time I ran this patch I had no issues. I ran patches 2843058,2408149,2344175, 2855600 and 2885384 prior to running this patch. This time through I have only run 2673262 and 2885384 and 2673262 should have included all the previous ones. Patch 1453927 is applied and I get the following:
    $ loadjava -user apps/apps -verbose -resolve -force xmlplsql.jar
    Class not found: oracle.aurora.server.tools.loadjava.LoadJavaMain
    It appears the file is there, and that adovars.env is set up correctly? Anything else to check?
    Thanks,
    Kristin

    Thanks Steve. I got installed properly. I works now. I beleive you are the author of the book "Building Oracle XML applications". Infact i am using your book to start my XML carrier. It is really a good book. Good Job. Please reply when you get a chance. I am surprised about your reply.
    Thank a lot.
    Leo.

  • Writing Manifest to existing jar via API

    I've looked through several forum posts now but none do quite what I would like. I want to be able to write info to the manifest file of a jar file so that I can make jar file executable. So far all I've found is code to copy jar files, nothing that targets writing of the manifest file. Can anyone show me how as I haven't worked with zip/jar files before?

    Hmm... where's the PM button when u need it! Can you send it to: [email protected]
    I would be very greatful if u could email me the .java file(s) of your app. I only want to use the app personally, not distribute it.

  • Running Java Program via bat file

    Hi
    I have a bat file. I have compile the java files and the class files into the same folder.
    I am suppose to double click on the bat file and it is suppose to run (in the same manner as IDE)
    but it only appear the 1st line of the program. Whatever i type, it refuse to budge.
    What should i do to retify the problem?
    I have already set the classpath properly

    Hi
    I just realised that my program can only run halfway on the dos...
    This is my code sample
    try{
                pw = new PrintWriter("TS.log");           
                System.out.println ("hi");
            catch(IOException io){
                io.printStackTrace();
            try {
                StandAloneApplication = true;
                String[] a = new String[1];  
                System.out.println ("hi2");
                Settings settings = Settings.getInstance();
                StringTokenizer letterToken = new StringTokenizer(settings.get("letter"),",");
                Vector <String> v = new Vector<String>();
                while(letterToken.hasMoreTokens()){
                    v.add(letterToken.nextToken());
                String letter[] = v.toArray(new String[v.size()]);
                System.out.println ("hi3");
                DbConnection d = new DbConnection();
                String stocklist = d.getStockList();
                String mainFile ="";
                GenerateSLS sMain = new GenerateSLS("timeSales.sls");                                               
                String sessionID = d.createiFisSession();                      
                System.out.println ("hi4");
                for(int i=0;i<letter.length;i++){
                    System.out.println ("print");
                    mainFile = sMain.start("timeSalesGen"+letter[i]+".sls",d.getStockList(letter[i]+"%.SI"),sessionID);
                    a[0] = mainFile;       
                    staticArguments = a;       
                    Viewer viewerMain = new TSMainCapture();       
                    viewerMain.init();          
                    viewerMain.start();it stops printing after "hi4"
    btw, I have tried to run this on the bat file again.
    IDE side retest, re-compile and rerun, work well
    Pls help
    Thanks.
    Lots of appreciation

  • Inserting User Device Profiles via BAT

    I have been trying to insert User Device profiles using the BAT utility. When I select the Insert User Device Profiles Specific Details, select the file, and run the job it fails. However when I select the "Insert User Device Profiles All Details" the spreadsheet I chose is not uploaded but all new profiles are created and added. I am very confused because I am including all the details that are oulined as required on the "specific details" file I am trying to insert and it fails every time with a "device name" error but when I select the "all devices" the same uploaded file works fine?? Any advice/feedback would be very much appreciated.
    Thank you!

    Hey Vicky,
    I just spent some time browsing the numerous Bugs related to BAT in the CUCM 5.1(x) versions. There are well over 250 Bugs :( I'm guessing that you may be hitting this one that does not identify * Mandatory Fields properly (like Device Name);
    CSCsj74131 Bug Details
    BAT.xlt UDP work sheet need changes.
    Symptom:
    BAT.xlt UDP work sheet need changes
    Conditions:
    Steps to Reproduce:
    1. Download BAT.xlt.
    2. Open it and goto UDP work sheet.
    3. You could find "Device Profile name " as "optional"
    It should be mandatory.
    Also create file format for UDP missing "service".
    work Around:
    none
    Status
    Fixed
    Severity
    4 - minor
    Last Modified
    Any Time
    Product
    Cisco Unified Communications Manager (CallManager)
    Technology
    1st Found-In
    5.1(2.9901.30)
    Fixed-In
    Release-Pending
    Hope this helps! Just a guess here (sorry),
    Rob

  • Can only launch sqlDev 3.0 via .bat file

    I just downloaded 3.0 and extracted to a new folder. (winXP) The older version worked fine. Whenever I launch sqldeveloper.exe, I get " UNable to create an instance of the Java Virtual Machine"
    However, I am able to successfully launch when executing the sqldeveloper.bat file. AM I missing a configuration step?

    Make sure you're pointing to a 1.6 JDK in \sqldeveloper\bin\sqldeveloper.conf or delete the entry to get prompted to browse for it on next startup:
    SetJavaHome C:\Archivos de programa\Java\jdk1.6.0_16Hope that helps,
    K.

  • Planning load utility via bat file - error

    I am using a bat file that uses the Planning load utility to make numerous updates to a single dimension on a test server. When I run the bat file i get an error that says the dimension is locked by another user. I am the only user with access to the test server. I've checked EAS and planning and nothing is locked. I've even shut down all hyperion services on the server and restarted them. It still says that the dimension is locked. How can I get this to unlock when I don't see where it is locked? This is a high priority situation! Any help is greatly appreciated!

    Thanks John - I think your scenario is what happened. Initially, when I ran the bat file, I got an error 'Java out of memory - java heap'. So I had to fix that and then I got the locked error. So you're saying that since it locked the dimension then erred, the lock was never able to be removed. I got it! Thanks so much! :) Jeri

  • Calling .exe or .bat from Jar

    I need to call either an .exe or a .bat file from a jar via the Runtime.exec() and was hoping to ship those from within my JAR (and hence call them while they are in the JAR but I need to get a full path to the executable) is that possible?

    Hi,
    i'm not shure if this is possible.
    When i have to do this i extract the needed files and execute them.
    Kind regards

Maybe you are looking for

  • How can I manage the songs recommended to me in emails?

    So a while back I bought some gag songs to put together a compilation. Now I get near weekly emails from iTunes telling me about all the new songs I might like based on those gag songs. How can I get itunes to stop recommending those to me? Is there

  • How do I fix the error getting bad device-uri

    I am trying to add a domain printer to my new Mac running Mavericks all but one network printer get the same error bad device-uri "smb..... Can anyone tell me a way around this error.

  • Change document raster effects to 300dpi??

    Using Illustrator CS Am up against a deadline for an image to be printed at 300. Made image using default of 72 dpi. As you would expect and I did not, when coverting to 300 dpi, the appearance of my gaussian blurs are diminished to the point where t

  • S cable vs. av cable vs. cheapos from radio shack

    I just got my ipod video and am trying to connect it to the front av ports on my tv with no luck. i am using a working cable from radio shack that has 2 audios and one video from a headphone jack. i don't have the dock. this does not work. is apple's

  • Run a sql file from java

    I have a SQL file named myfile.sql which contains something as follows:-Declare Begin insert into alphaweb values (1); end; .What I am looking for is a way to execute this through a java code. e.g. something like reading the String from the the file