0

Hi i have made a Jar file of my Springboot app , now when i run it with java -jar myapp.jar it run successfully , but it is accessable at localhost:8080/

not on localhost:8080/myapp

this do not include appname in url ,

can anyone tell me why and how do we change this setting , while deploy with War file it is working fine on localhost:8080/myapp

Rishabh
  • 1
  • 2

1 Answers1

0

add this to your application.properties in src\main\resources folder

server.contextPath=/youapp/*

also you can change port

server.port = 8880
Parviz Rozikov
  • 259
  • 2
  • 10
  • Hi Parviz , now i am able to access it on my contaxt path , but when i tried to load a file resides in resource folder by class loder ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("documents/" + id).getFile()); i am unable to access it and got the following error java.io.FileNotFoundException: file:\C:\Users\rishabh.jain1\Documents\workspace-sts-3.8.2.RELEASE\SpringMVCMavenProject\target\SpringMVCMavenProject.jar!\BOOT-INF\classes!\documents\sample1.pptx – Rishabh Dec 15 '16 at 05:55