Reputation: 345
I'm new to spring boot. I have written code to display "hello world". HelloWorld1Application.java: package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWorld1Application {
public static void main(String[] args) {
SpringApplication.run(HelloWorld1Application.class, args);
}
}
AppConfiguration.java :
package com.example.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AppConfiguration {
@RequestMapping("/hello")
public String hello() {
return "Hello World";
}
}
It runs fine in Eclipse ide. I have tried it in terminal n got proper output(java -jar target/HelloWorld1-0.0.1-SNAPSHOT.jar). Now I want to run this program in windows. How can i do that? Where can i find the bytecode of this application? How to execute it in command prompt of windows?
Upvotes: 1
Views: 8326
Reputation: 689
mvn spring-boot:run
Upvotes: 2
Reputation: 71
You also need to set JAVA in your PATH environment variable. Add location till bin in your path variable
C:>path
C:>PATH=C:\Program Files\Java\jdk1.8.0_171\bin
C:>java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
Upvotes: 1
Reputation: 4088
HelloWorld1-0.0.1-SNAPSHOT.jar
to windowsjava -jar HelloWorld1-0.0.1-SNAPSHOT.jar
in command promptNote: make sure you have JRE installed on windows machine.
Upvotes: 3