Results 1 to 3 of 3
  1. #1
    Java_Mad is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Smile Help with .bat batch file problem

    Hi,

    This is my first post so please bear with me.

    I am trying to create a .bat file that will do the following:

    Launch python
    Run a python script that picks up the 3rd party jars required to run my java app,
    Run the java script
    Increase the memory allocated to the java virtual machine.

    I have got this far


    Java Code:
    @echo off  
    start c:\python27\python c:\run.py  
    cd c:\jars2run\myown\  
    javac ClassTree.jar Simulator.Engine  
    java -xms 1024m -xmx 1024m -xss 1024m %CLASS%  
    pause


    where:
    start c:\python27\python c:\run.py
    will run python and pick up the 3rd party jars needed for the application

    cd c:\jars2run\myown\
    changes the directory to where the main .jar tree is located (not sure if i need)

    javac ClassTree.jar Simulator.Engine
    is the project and main class of the application

    java -xms 1024m -xmx 1024m -xss 1024m %CLASS%
    trying to allocate additional memory to the application

    When I run the .bat file I get the following error message:

    error: Class names, 'ClassTree.jar,Simulator.Engine', are only accepted if annotation processing is explicitly requested
    1 error
    Unrecognized option: -xms
    Could not create the Java virtual machine.
    Press any key to continue . . .

    I have written the java code in Eclipse and was running the code from the command line with the following statement without any trouble (but now need additional memory hence moving to a batch file)

    c:\python27\python c:\jars2run\run.py c:\jars2run\myown\ClassTree.jar Simulator/Engine


    I am really new to writing batch files and if somoeone could have a look and show me a solution to my problem, I would be very grateful.

    Many thanks

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    why do you call ClassTree.jar with javac? If this is a jar that must be found to compile the Simulator.Engine then use -cp with javac.

  3. #3
    Java_Mad is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default

    hi j2me64,

    Thanks for your reply.

    I have added the -cp to the .bat file and changed the javac to java, but am still getting an error.

    Java Code:
    @echo off  
    start c:\python27\python c:\run.py  
    cd c:\jars2run\myown\  
    java -cp ClassTree.jar Simulator.Engine  
    java -xms 1024m -xmx 1024m -xss 1024m %CLASS%  
    pause
    error msg is:

    Exception in thread "main" java.lang.NoClassDefFoundError: Simulator/Engine
    Caused by: java.lang.ClassNotFoundException: Simulator.Engine
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Unrecognized option: -xms
    Could not create the Java virtual machine.
    Press any key to continue . . .

    any idea what I need to do (very new to this)

    Many thanks

Similar Threads

  1. How build the applicatoin by using Batch file script
    By Kishore.Kumar in forum Eclipse
    Replies: 0
    Last Post: 02-11-2009, 08:42 AM
  2. Batch file to Run Java application
    By nitishlnt in forum Eclipse
    Replies: 1
    Last Post: 10-24-2008, 07:46 PM
  3. eclipse batch file
    By doug99 in forum Eclipse
    Replies: 6
    Last Post: 04-24-2008, 02:59 PM
  4. run a batch file as windows nt service
    By radhika123 in forum New To Java
    Replies: 0
    Last Post: 04-04-2008, 01:46 PM
  5. Problem in batch file
    By marwa in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 10:24 AM

Posting Permissions

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