SpringBoot: How to provide VM Argument in Spring Boot App, while running from Eclipse

22,592

Program arguments, are arguments that passed to main method of your program. Looks like space-separated list of values. Example:

java Program arg1 arg2 arg3

VM arguments, are system properties passed to the Java Virtual Machine in name=value format. Examle:

java -Dprop1=value1 -Dprop2=value2 Program

In your case you need to add VM arguments but not Program arguments

By the way, according to documentation, you can add loader.path and loader.main properties right in your application.properties. Information about how to work with application.property, and how to externalize configuration settings you can find here.

Share:
22,592
anij
Author by

anij

a developer

Updated on July 09, 2022

Comments

  • anij
    anij almost 2 years

    I'm Using Spring Boot 1.3.0.RELEASE. And for my application, I'm providing some external jar path like below, while I'm running the app from CMD.

    java -Dloader.path="lib,config,C:/TM/ojdbc14-10.2.0.2.0.jar,spring" -jar ticketmanager-application-0.3.0-SNAPSHOT.jar
    

    Now, when I'm trying to run the app from eclipse, I'm add the -Dloader.path="lib,config,C:/TM/ojdbc14-10.2.0.2.0.jar,spring" to VM Argument. Like the snapshot shown below.

    enter image description here

    Editing: Adding Maven Spring Plugin configuration ------------------------

    Here, the configuration section, I have added for the loader.path

    <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>1.3.0.RELEASE</version>
                    <configuration>
                        <layout>ZIP</layout>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    

    Therefore, my question, How should I add this Argument? because it's not working :(