Setting Java options in Eclipse
You can set Java options (custom properties) in eclipse on tomcat. These setting will be then applied to all the projects that you will try to run using your tomcat server.Now let me describe you the exact problem that i was facing :-
I was using maven automatic build script to deploy my Spring MVC project. That project was using Java run-time options to detect the environment in which project is currently running (LOCAL, DEV, PROD). System behavior will change as per environment.
One way of defining Java options inside eclipse is to create setenv.sh file in tomcat's bin and add your java options there. Then your maven automatic build script will work fine.
Another way of doing it is to added server(tomcat in my case) to Eclipse only and want to set the same setting in eclipse.
Then steps below will show how to do it.
Start by going to
Preferences > Tomcat > JVM Settings > Append to JVM Paramaters
Now you can set Java options in "VM arguments" box as you can see in the above screen. I have added -DruntimeEnv="LOCAL" option for demo.
Changing Eclipse default deployment directory
Apart from it i also required to change eclipse default deployment directory to my tomcat's Webapps->ROOT. I did this using following steps-1. Double click Tomcat server added to Eclipse.
2. Go to module part of view.
3. add your project as module if not added already.
4. change "classpath" to "/" (In my case).
0 Comments
Post a Comment