Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

run java code through bat file

 
nancy andrew
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to run a java standalone program using a batch file. How can i do it
 
nancy andrew
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried running through the following code in batch file. But nothing happens.



Can anyone please tell what to modify or change in the above
 
Stephan van Hulst
Bartender
Pie
Posts: 5811
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you're running a jar file, you should probably include the .jar extension.
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not a JAR file on line 6, is it?
 
nancy andrew
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont want to make jar file . I want to run my java file. I got that piece of code through internet. That is wrong and not working. Kindly tell me how to correct it. There is a simple HelloWorld.java standalone program. I want to run it using batch file
 
Alpesh Gediya
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
at line 6 use following instruction

java "path to location in which helloworld.class present"/Helloworld (do not include .class)
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, definitely not. It's
 
Alpesh Gediya
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:No, definitely not. It's


You are right Rob,
In hurry forgot to put -cp in command.

Thanks for correction.

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15281
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note, that since the paths contain spaces, you must enclose them in quotes:

set JAVA_HOME="C:\Program Files (x86)\Java\jdk1.5.0_09"
set PATH="C:\Windows;C:\Windows\System32;C:\Program Files (x86)\Java\jdk1.5.0_09\bin"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic