Skip to content

Instantly share code, notes, and snippets.

@hirokazumiyaji
Created May 30, 2017 07:38
Show Gist options
  • Save hirokazumiyaji/11c9e08ef1e0d865ecbf909dffeb5588 to your computer and use it in GitHub Desktop.
Save hirokazumiyaji/11c9e08ef1e0d865ecbf909dffeb5588 to your computer and use it in GitHub Desktop.
Spring Boot jar file directory
package com.example.demo;
import java.nio.file.Paths;
import java.io.File;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
File jarFile = new File(System.getProperty("java.class.path"));
System.out.println(Paths.get(jarFile.getAbsolutePath()).normalize().getParent().toString());
SpringApplication.run(Application.class, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment