4

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 :(

anij
  • 1,322
  • 5
  • 23
  • 39
  • You're already added it. So, what is your problem? – Ken Bekov Feb 04 '16 at 13:04
  • Another thing: why do you use such an ancient Oracle driver ? – Marged Feb 04 '16 at 16:51
  • And: what exactly is not working ? – Marged Feb 04 '16 at 16:51
  • well, my driver jar, stays outside app.jar, so using loader.path I'm passing the path of the external jar. Now, this thing is working while executing from CMD But, not working while using eclipse vm argument, ad running as spring boot app – anij Feb 04 '16 at 17:10
  • Show the code where you use the loader.path ? – Marged Feb 04 '16 at 17:38
  • Well, when I'm running from CMD, only running this command `java -Dloader.path="lib,config,C:/TM/ojdbc14-10.2.0.2.0.jar,spring" -jar ticketmanager-application-0.3.0-SNAPSHOT.jar` works. But, from eclipse, I tried by writing in application.properties file like `loader.path: lib,config,C:/TM/ojdbc14-10.2.0.2.0.jar,spring`. And then in eclipse VM argument as, you can see the image, `-Dloader.path=lib,config,C:/TM/ojdbc14-10.2.0.2.0.jar,spring` But both approch doesn't work. Apart from that, I did'n write any code for this. And, JDBC, is loading in server startup, from a Spring bean config. – anij Feb 04 '16 at 17:51
  • Are you using the STS version of eclipse? Are you running it as a Spring Boot App? – whistling_marmot Feb 04 '16 at 20:23
  • If the `loader.path` is being ignored when running through eclipse, you may have to add the jar and folders to the build path like this: right-click/Build Path/Configure Build Path/Libraries – whistling_marmot Feb 04 '16 at 20:25
  • Yes, @whistling, that way, it is working – anij Feb 10 '16 at 05:05

1 Answers1

3

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.

Ken Bekov
  • 13,696
  • 3
  • 36
  • 44
  • Ok!.. I added loader.path in application.properties, but still its not working. any idea? – anij Feb 04 '16 at 14:19
  • @anij first, try to pass `loader.path` thru VM arguments. I don't know, why yours `application.properties` does not work. mine works well. pleas check that you put `application.properties` into proper place. – Ken Bekov Feb 04 '16 at 15:40
  • yes I have placed the application.properties, in proper place, because, I'm also reffering other properties from application.properties as `-Dxxx=123` while starting the app from cmd or linux. I have placed the config like this `loader.path = lib,config,c:/ojdbc14-10.2.0.2.0.jar` in the top of the file. but it's not working. – anij Feb 04 '16 at 16:39
  • From CMD mode: both loader.path & other properties also working like defining port & all, but from Eclipse VM argument setting others are working.. only loader.path is not working – anij Feb 04 '16 at 17:07