Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Tuesday, October 7, 2014

Cannot make Project Lombok work on Eclipse (Helios)

After adding lombok and restarting eclipse or spring tools my project still failed to recognize getters and setters. Red markers everywhere!
The solution: right-click your project, go to Maven and select Update Project
After hours of searching and trying random solution, I find this to be the only solution that worked for me.
enter image description here

Tuesday, May 20, 2014

How to use Special Chars in Java/Eclipse

It can be solved by setting encoding in eclipse:
1st way:
At the menu select File-->Properties and then at the "Text file encoding" section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button
2nd way:
Right click on specific file (say Test.java) -> Properties. In Text file encoding section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button
3rd way:
If you want to make this change for all your project go at Window-->Preferences--> General--> Workspace . In Text file encoding section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button
http://stackoverflow.com/questions/200691/how-to-use-special-chars-in-java-eclipse

Monday, May 5, 2014

Can't execute a simple HQL query from Hibernate Tools

When I generated the domain code and the hbm files from my database using Hibernate Tools, the catalog property was set for all my mapping files, so when I execute a query the generated SQL looks for bd.bd.table instead of bd.table.
So I removed the catalog property from all my mapping files
<hibernate-mapping>
<class name="beans.Famille" table="famille">
//...
</class>
</hibernate-mapping>
and now the generated code looks like this:
HQL:
from Famille
SQL:
select
  famille0_.familleID as familleID128_,
  famille0_.libelle as libelle128_ 
 from
  bd.famille famille0_

Thursday, April 17, 2014

A cycle was detected in the build path of project xxx - Build Path Problem

Mark Circular dependcies as "Warning" in Eclipse tool to avoid "A CYCLE WAS DETECTED IN THE BUILD PATH" error. In Eclipse got to :-> Windows -> Prefereneces -> Java-> Compiler -> Buliding -> Circular Depencies
Thanks

Wednesday, March 5, 2014

Eclipse - Unable to install breakpoint due to missing line number attributes

I had the same error message in Eclipse 3.4.1, SUN JVM1.6.0_07 connected to Tomcat 6.0 (running in debug-mode on a different machine, Sun JVM1.6.0_16, the debug connection did work correctly).
Window --> Preferences --> Java --> Compiler --> Classfile Generation: "add line number attributes to generated class file" was checked. I did a clean, recompile. I did uncheck it, recompile, check it, recompile. I made sure the project did use the global settings. Still the same message.
I switched to ant build, using

Still, same message.
I didn't find out what caused this message and why it wouldn't go away. Though it seemed to have something to do with the running Tomcat debug session: when disconnected, recompiling solves the issue. But on connecting the debugger to Tomcat or on setting new breakpoints during a connected debug session, it appeared again.
However, it turned out the message was wrong: I was indeed able to debug and set breakpoints, both before and during debugging (javap -l did show line numbers, too). So just ignore it :)

Thursday, February 27, 2014

jump into interface implementation in Eclipse IDE

Here's what I do:
  • In the interface, move the cursor to the method name. Press F4. => Type Hierarchy view appears
  • In the lower part of the view, the method should already be selected. In its toolbar, click "Lock view and show members in hierarchy" (should be the leftmost toolbar icon).
  • In the upper part of the view, you can browse through all implementations of the method.
The procedure isn't very quick, but it gives you a good overview.

Press ctrl-t on the method name (rather than F3). This gives the type hierarchy as a pop-up so is slightly faster than using F4 and the type hierarchy view.
Also, when done on a method, subtypes that don't implement/override the method will be greyed out, and when you double click on a class in the list it will take you straight to the method in that class.

A cycle was detected in the build path of project xxx - Build Path Problem

Mark Circular dependcies as "Warning" in Eclipse tool to avoid "A CYCLE WAS DETECTED IN THE BUILD PATH" error. In Eclipse got to :-> Windows -> Prefereneces -> Java-> Compiler -> Buliding -> Circular Depencies
Thanks

Sunday, September 29, 2013

using github + eclipse to pull code

eGit doesn't know, which remote branch you want to pull from. If you create your local branch based on a remote tracking branch, then the key is generated automatically. Otherwise you have to create it yourself:
branch.master.merge=refs/heads/master
branch.master.remote=origin
where master stands for the branchname, in the key it's your local branch, in the value it's the branch in the remote repository. Place that in the repository-specific configuration file%repositorypath%\.git\config
As for the terms:
  • merge: join two or more development histories together
  • fetch: download objects and refs from another repository
  • pull: fetch from and merge with another repository or local branch
  • sync: allows you to compare 2 branches
In general, I urge you to read eGit user guide, where you can get even better understanding of Git and eGit. It can be found at http://wiki.eclipse.org/EGit/User_Guide

Tuesday, September 3, 2013

maven-archetype-webapp eclipse problem

imply create a java directory under main (i.e. src/main/java) and right-click on your project and selectMaven > Update Project Configuration.

http://stackoverflow.com/questions/3042518/maven-archetype-webapp-eclipse-problem

Thursday, August 29, 2013

When pushing to remote Git repo using EGit in Eclipse, what should I choose?

You see this screen in Egit Push URI documentation:
Push Ref Specification
That is where you define the refspecs:
A "refspec" is used by fetch and push operations to describe the mapping between remote Ref and local Ref.
Semantically they define how local branches or tags are mapped to branches or tags in a remote repository.
In native git they are combined with a colon in the format :, preceded by an optional plus sign, + to denote forced update.
In EGit they can be displayed and also edited in tabular form in the Push Ref Specification and the Fetch Ref Specification and other dialogs.
The "left-hand" side of a RefSpec is called source and the "right-hand" side is called destination.
Depending on whether the RefSpec is used for fetch or for push, the semantics of source and destination differ:
For a Push RefSpec, the source denotes a Ref in the source Repository and the destination denotes a Ref in the target Repository.

Push Refspecs

A typical example for a Push RefSpec could be
HEAD:refs/heads/master
This means that the currently checked out branch (as signified by the HEAD Reference, see Git References) will be pushed into the master branch of the remote repository. 
http://stackoverflow.com/questions/10365958/when-pushing-to-remote-git-repo-using-egit-in-eclipse-what-should-i-choose

Problems setting up a dynamic web project in eclipse using Java EE and Tomcat

I created a maven project using the command mvn archetype:generate ... to generate the project structure which I then imported into Eclipse. I then added a dynamic web facet to the project.
You shouldn't have to add any facet, things should just work if your project has a packaging of type war.
It would thus have been nice to provide the full command you used to create your project with the archetype plugin. Did you use the maven-archetype-webapp archetype? Did you ran something like that:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp \
  -DgroupId=my.group.id -DartifactId=my-artifact -Dversion=1.0-SNAPSHOT
If not, then be sure that your pom has a war and that you use the default structure for a war project (see Usage for an example).
Then, what plugin are you using for the Eclipse integration? How did you import the project into Eclipse?
If you are using the maven-eclipse-plugin (if you ran eclipse:eclipse), then you need to configure it for WTP support. You need to pass the wtpversion on the command line (or to configure the plugin in the POM):
mvn -Dwtpversion=2.0 eclipse:eclipse
If you are using m2eclipse, then just import your project as a Maven Project (right-click the Package Explorerthen Import... > Maven Projects).
In both case, your project should be recognized as a Dynamic Web Module that you can Run on Server). There is nothing manual to configure for this (no facet to add).
Update: Did you install the Maven Integration for WTP (Optional) when installing m2eclipse?

mvn eclipse:eclipse within Eclipse

Yup, when you right-click over the project, in the Maven sub-menu, you have an Update Project Configuration command which does precisely that.

http://stackoverflow.com/questions/3288005/mvn-eclipseeclipse-within-eclipse

Thursday, August 15, 2013

Eclipse.ini settings

Eclipse startup is controlled by the options in $ECLIPSE_HOME/eclipse.ini. If $ECLIPSE_HOME is not defined, the default eclipse.ini in your Eclipse installation directory is used. eclipse.ini is a text file containing command-line options that are added to the command line used when Eclipse is started up.

Warning:

  • Each option and each argument to an option must be on its own line. 
  • All lines after -vmargs are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before -vmargs (just like when you use arguments on the command-line)
Windows eclipse.ini example : 
01.-showsplash
02.org.eclipse.platform
03.--launcher.XXMaxPermSize
04.256m
05.-vm
06.C:\Java\JDK\1.5\bin\javaw.exe
07.-vmargs
08.-Xms40m
09.-Xmx512m
The eclipse.ini file is divided into two parts: 
  • The Eclipse part 
  • The JVM part 
Theses two parts are separated by the -vmargs argument, which indicates that all what follows concern the JVM.

Some configurations 

Defines the workspace path

PLATFORM
CONFIGURATION
Windows Platform
-Dosgi.instance.area=C:\var\workspace
Linux Platform or Mac Platform
-Dosgi.instance.area=/home/my_user/workspace


Basic memory management configuration

PLATFORM
CONFIGURATION
-Xms512m
minimum memory size for pile and heap
-Xmx1024m
maximum memory size for pile and heap
-XX:MaxPermSize=512m
maximum memory size for storing permanent JVM objects

Encoding and default language

PlatformConfiguration
-Dfile.encoding=utf8   
To Set UTF-8 as the Default Encoding for New Text Files
-Duser.language=enTo set eclipse console locale/language

http://www.java-tutorial.ch/eclipse/eclipseini