Softwares to install in Eclipse for Java and Web Dev

 

.            Install New Software in Eclipse:

•Search for Web and Add All

•Search for Spring and add all (STS)

•Eclipse Java EE Developer Tools

•Eclipse Java Web Developer Tools

•Eclipse Web Developer Tools

•Eclipse XML Editors and Tools

 

 

Use use 1.6_45 for all software install

Advertisements

Eclipse Tips

 

  1. eclipse wrap text
    1. Ctrl+Shift+F will format a file in Eclipse, breaking long lines into multiple lines and nicely word-wrapping comments.
    2. http://ahtik.com/blog/projects/eclipse-word-wrap/
    3. Last caret position: Alt+left
    4. eclipse hangs frequently
      1. Increase the Heap size

i.      http://stackoverflow.com/questions/15313393/how-to-increase-heap-size-in-eclipse

ii.      http://stackoverflow.com/questions/15061364/increasing-java-heap-size-in-eclipse-using-virtual-memory

iii.      http://stackoverflow.com/questions/8600972/increasing-heap-space-in-eclipse-java-lang-outofmemoryerror

iv.      BEST: http://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F

  1. Changes to static files like html and css are not reflected immediately.
    1. In the Publishing section of Tomcat, set it to Publish automatically
    2. To be sure, click on the publish button on the server tab post saving (Actually it will save on its own). Shortcut is Ctrl + Alt + P
    3. IN case tomcat is storing state in remote location, eclipse may hang up every few min, and at that time console will show:

11:06:28.120 [BackgroundCleanupThreadOf-ConnectionPoolOf-datasource] DEBUG msjava.pool.base.BasePeriodicService – Periodic service ‘BackgroundCleanupServiceOf-ConnectionPoolOf-datasource

 

Actually its doing this  : org.apache.catalina.core.StandardContext reload

this is happening every 10 min, and it hangs for 30-50 sec

tomcat is running

 

tomcat 7 not serving html chages instantly

 

OK so this is what it is:

  1. Editing html file in Eclipse
    1. Edit the file
    2. Save the file
    3. Clear the N/W logs in Chrome
    4. Use Ctrl + Shift + R to reload the page (or  Ctrl F5)

This way the changes reflect immediately

Doing it any other way takes way longer

Note: In chrome inspector check the “Disable cache option”

 

  1. Editing the file in VS
    1. Even though I have opened the file as link in vs, the changes in file are not reflecting ever

 

 

 

Setting up Eclipse

Install the latest version of JavaEE

1.       Using Tomcat 7 in eclipse

http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html

 

A server runtme allows a ‘class’ of server to be targetted. Without a runtime, a reference to a server cannot be created.

  • Window | Preferences, and search for ‘runtime’, select ‘Server | Runtime Environment’.
  • Add ‘Apache | Apache Tomcat v7.0’
  • Give it a name
  • The installation directory is: M:\dist\apache\PROJ\tomcat\7.0.40\common\tomcat

Creating a Server

  • File | New | Other… | Server | Server
  • Apache | Apache Tomcat v7.0 | Server
  • Host name could be either localhost, or the machine name, including the domain name. It may be more convenient to choose the latter because it is necessary to use a machine in the .ms.com domain when using siteminder.
  • Give it a name

2. Install all needed plugins from help -> Install Software

Eg. For web dev, search for web and install all softwares from All Available Sites

Install Spring etc. as well

3.

  1. If it gives you tampering error while installing the Plugin then relaunch your eclipse 3.8  with java version 1.6.0_xx. After eclipse installation retry to install the plugin.

Once the plugin is installed you can change the java version to 1.7  if required.

in-memory H2 instance

 

examining H2 by a web browser

The correct configuration of H2 for interactive web query is something of a black art. The approach described here may not be the only way to do it, it may not even be the best way, but it does work.

The “IR Standalone Pipeline” launch configuration in /DslInboundRouter.App.Test/src/eclipse/IR – StandalonePipeline.launch provides a working example via the spring configuration /DslInboundRouter.App.Test/src/java-test-src/dsl/inboundrouter/config/standalone-pipeline-bootstrap.xml

Create the in-memory H2 instance

From /DslInboundRouter.App.Test/src/java-test-src/dsl/inboundrouter/config/datasource-h2.xml

<bean id=”dslDataSource” class=”msjava.dbpool.datasource.H2DataSource”

p:databaseName=”mem:1;AUTOCOMMIT=ON;LOCK_MODE=1;MVCC=true”

p:performExpiration=”false”

p:minIdle=”10″ />

This bean creates an in-memory H2 instance, that does not support any TCP connectivity, so is accessible only from within the JVM

Create an H2 TCP server

From /DslInboundRouter.App.Test/src/java-test-src/dsl/inboundrouter/config/webserver-h2.xml

<bean id=”h2TcpServer”

factory-method=”createTcpServer”

init-method=”start” destroy-method=”stop” lazy-init=”false”>

<constructor-arg value=”-tcp,-tcpAllowOthers,true,-tcpPort,8043″/>

</bean>

This creates an instance of an H2 TCP server on port 8043 that can accept H2 JDBC client connections from other processes. The instance is not linked to the database instance we have already created – that is done at connect time according to the JDBC connection string used.

The -tcpAllowOthers option in the constructor arguments means that connections will be accepted from other hosts. Default behaviour is to accept connections from the current host only.

Create an H2 Web server

Also from /DslInboundRouter.App.Test/src/java-test-src/dsl/inboundrouter/config/webserver-h2.xml

<bean id=”h2WebServer”

factory-method=”createWebServer”

init-method=”start” destroy-method=”stop” lazy-init=”false”>

<constructor-arg value=”-web,-webAllowOthers,-webPort,11111″/>

</bean>

This creates an instance of an H2 web server on port 11111. Again, there is no implicit link between this web server and the tcp server defined above. The -webAllowOthers allows connections from browsers on other hosts; by default only local connections are accepted.

Using the browser

Browse to http://localhost:11111/ to connect to the H2 Web server, this will present a login screen

Enter jdbc:h2:tcp://localhost:8043/mem:1 as the JDBC Url to connect to.

If browsing from another host, you would still use localhost in the JDBC url (but not the http url) as the JDBC url is resolved relative to the location of the H2 web server.