How to execute Jar file using Batch file.

S

Sriram

Hello All,

I am new to java.

I used eclipse environment to devlop a java project whic his executing
fine
but i am facing using in batch file execution

I have created a project under C:\tool\NewTool
Eclipse IDE had folder scr & bin
under which i created a package Pack1 where i had my java files


Batch file content -> jar & bat in same folder (NewTool)
=============
@echo off
cls
Set ClassPath=%ClassPath%; cmdbwc.jar
java -Xmx200m -cp .src.cmdbwc.cmdbw_main %1 %2 %3 %4 %5 %6 %7



Call & Error
===========
C:\UtilityTool\cmdbwc>java -Xmx200m -cp .src.cmdbwc.cmdbw_main -i "C:
\UtilityToo
l\Deny.log" -d " " -o "C:\UtilityTool\Denyreport.html"
Unrecognized option: -i
Could not create the Java virtual machine.

Please help me out.
TIA,
Sriram.
 
L

Lew

Sriram said:
Hello All,

I am new to java.

I used eclipse environment to devlop a java project whic his executing
fine
but i am facing using in batch file execution

I have created a project under C:\tool\NewTool
Eclipse IDE had folder scr & bin
under which i created a package Pack1 where i had my java files


Batch file content -> jar & bat in same folder (NewTool)
=============
@echo off
cls
Set ClassPath=%ClassPath%; cmdbwc.jar
java -Xmx200m -cp .src.cmdbwc.cmdbw_main %1 %2 %3 %4 %5 %6 %7



Call & Error
===========
C:\UtilityTool\cmdbwc>java -Xmx200m -cp .src.cmdbwc.cmdbw_main -i "C:
\UtilityToo
l\Deny.log" -d " " -o "C:\UtilityTool\Denyreport.html"
Unrecognized option: -i
Could not create the Java virtual machine.

Your classpath is wrong - it's a path, not some weird dot notation thing.

-i is an invalid option, as the message mnost clearly states. What did you
imagine that it did?

Likewise with -d and -o.

You also need to specify a class with a "public static void main( String []
args)" method in it, which you did not do.

Details are in the Java Tools docs for the 'java' command:
<http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top