• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

maven project import to eclipse problems

 
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

maven project importing to eclipse giving attached problems.
when i went to project properties---java compiler i see 1.4.

How to change to 1.7 in eclipse. Do i need to download JDK 1.7 for that.
when i see the java build paths shows j2se1.4.

when i see target runtime i see JRE 1.8.

Please advise
Problems.png
[Thumbnail for Problems.png]
1
Problems2.png
[Thumbnail for Problems2.png]
2
Problems3.png
[Thumbnail for Problems3.png]
3
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one other file is as attached
Problems4.png
[Thumbnail for Problems4.png]
4
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would try one or two things. Maybe the simplest is to change your default compiler to 1.8. The other thing would be to add a 1.8 JRE. Go to Window -> Preferences -> Java -> Installed JREs and add your 1.8 JRE. You may also have to change the project's JRE. Right-click on your project and go to Build Path -> Configure Build Path. Click on the Libraries tab. Try removing or editing the JRE library to change it to 1.8.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maybe the simplest is to change your default compiler to 1.8.



for this i need to down load jdk 1.8 on to my windows 7 laptop and then change the JAVA_HOME from Systeme Variables--->Advanced Variables to set to JDK1.8 which i just downloaded right?

Maven project pom.xml says



i feel to many places to change makes it more error prone as we may miss in any one of above 5 places namely

1. eclipse java compiler
2. eclipse jre runtime(can i give jdk1.8 which any way has jre1.8 built in that right?? please advise)
3. eclipse project jre
4. windows laptop JAVA_HOME
5. pom.xml configuration entry
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have the 1.8 JRE already, but you may need the 1.8 JDK. You can look in Windows Control Panel Installed Programs to check. If you're not sure, download the latest and install.

Then in Eclipse you just need go to Windows -> Preferences -> Java -> Compiler and change the level.

You can change your Maven project source and target to 1.8.


i feel to many places to change makes it more error prone as we may miss in any one of above 5 places namely

1. eclipse java compiler
2. eclipse jre runtime(can i give jdk1.8 which any way has jre1.8 built in that right?? please advise)


You are right. The JDK has the JRE in it and it installs for you.


3. eclipse project jre


Only if you have separate JREs for each project


4. windows laptop JAVA_HOME


Not many things use this anymore. I use mine just to add to the PATH variable.


5. pom.xml configuration entry



Yeah, there's a lot of places to change, but that's the cost of configurability.
 
Saloon Keeper
Posts: 22779
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To properly compile a project whose Maven POM demands Java 7, you need to have at least JDK 7 installed on your computer and configured as a JDK option to Eclipse.

You may employ a JDK version 8 (or higher), but in that case, for proper compatibility you need to mark your project as being Java 7 based so that the JDK 8 compiler and runtimes will operate in Java 7-compatible mode.

To do that, open the Project Properties, select the Java Build section, enable the project-unique settings (by default, Eclipse applies the same settings to all projects in the workspace and disables the project settings GUI controls), and select the "Java 7" compiler level option.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked c://Program Files/java in my windlows laptop.

I see jdk1.4
jdk1.6
and
jdk1.7


I changed the eclipse compiler to jdk1.7 along with pom configuration entry to 1.7

I still have 63 problems in eclipse. May be my JAVA_HOME is not set yet to jdk1.7 which i could not get time to check. I will check and change that also later. But JAVA_HOME is what eclipse and maven pom file depends on?
Please advise
 
Tim Holloway
Saloon Keeper
Posts: 22779
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse is itself a Java program, although I don't think it uses JAVA_HOME. JAVA_HOME is not a built-in feature of Java, just a convention. Maven does use JAVA_HOME to select the compiler that it runs under (Maven is also a Java application program). However, if you run Maven as a command inside Eclipse, Eclipse will select a JDK based on the Maven run settings. Eclipse actually builds internal Maven runs as though they were regular Java programs to run/debug (although with Maven-specific options). You can then edit the Maven run profile if you want to use a non-standard environment.

It's easy to add new JDKs to Eclipse. Just go to the dialog that lists your JDKs, click the "Add" button, point to the folder of the JDK to add and give it a name so that it can be selected as a project build option.
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Eclipse is itself a Java program, although I don't think it uses JAVA_HOME.


Correct, it doesn't. Without intervention, it uses whatever Java executable is first in the PATH. You can determine which executable this is at the command line by typing where java.

To change which version Eclipse uses to launch itself with, you have to change eclipse.ini, but that is seldom necessary.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where java also shows jdk1.7 which is correct.


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\ganesha>where java
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe
C:\Program Files\Java\jdk1.7.0_51\bin\java.exe

C:\Users\ganesha>


I checked JAVA_HOME Advancce Environment variable that also pointing same

C:\Program Files\Java\jdk1.7.0_51




 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking about the 63 problems displayed in Eclipse? Pick one, especially one that repeats a lot, and post it here with any code it points to.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It's easy to add new JDKs to Eclipse. Just go to the dialog that lists your JDKs, click the "Add" button, point to the folder of the JDK to add and give it a name so that it can be selected as a project build option.



As attached i seleccted 1.7 in compiler drop down in eclipse. How to point to that folder of JDK to resolve the errors. I still see JRE system library as J2SE1.4. Not sure why that did not get changed and from where to change that?


To change which version Eclipse uses to launch itself with, you have to change eclipse.ini



i better change to 1.7 since by default eclipse seems taking jdk1.4 which is very old version right. How to change it?

please advise
EclipseErrs.png
[Thumbnail for EclipseErrs.png]
err
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all errors still related to jdk version only looks like
err1.png
[Thumbnail for err1.png]
err1
err2.png
[Thumbnail for err2.png]
err2
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go to Window -> Preferences -> Java -> Installed JREs and add your 1.7 JRE (add a path to the 1.7 jdk folder). Make sure this JRE is checked.

While you're there, click on Compiler and change the compliance level to 1.7.

Click OK.

Right-click the project in the Project Explorer, Build Path -> Configure Build Path. Click the Libraries tab. Click on JRE Systems Library. Click Edit. Click on Workplace Default which should be jdk1.7. Click OK.

If you have any problems, post them, and be specific.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as attached and marked why it shows 1.4 for JRE system library where as inside it shows jre1.8 related jars
jre.png
[Thumbnail for jre.png]
jre
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right-click on the part you circled. Click on Workplace Default which should be jdk1.7. Click OK.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure. i will try once i reach home laptop. Hopefully that resolves those 63/64 errors

I still wonder how it is currently showing JRE system library 1.4
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed to default JRE1.8.0_25 as attached. I still have 64 errors complaining you need to have 1.5 and more. Do i need to change JDK as well somewhere apart from JRE?
please advise
JREEclipse4.png
[Thumbnail for JREEclipse4.png]
error
JREEclipse3.png
[Thumbnail for JREEclipse3.png]
default 1.8.0_25 JRE
JREEclipse2.png
[Thumbnail for JREEclipse2.png]
JRE
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is other screen how it was looking originally(1.4 not sure why eclipse took 1.4 at start up instead of taking from JAVA_HOME?) before change.

Please advise
JREEclipse.png
[Thumbnail for JREEclipse.png]
option
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maven i changed to 1.8 as below



then right clicked on project-->maven-->update project that reduced one error but i still have 63 errors though. please advise
updateProject.png
[Thumbnail for updateProject.png]
update
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As given in below link

http://stackoverflow.com/questions/19382370/openjdk-1-7-in-eclipse-operator-is-not-allowed-for-source-level-below-1-7

i went to my specific project and preferences. I see compiler drop down allowing only till 1.7 but not 1.8. How to enable 1.8

Please advise
ProjectPreferences.png
[Thumbnail for ProjectPreferences.png]
project preferences
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i right clicked project -->properties--->compiler--->i see 1.4 which is causing errors looks like.

when i click the buildpath link there it showed other screen with 1.4

How to change in the build path from 1.4 to 1.8. Do i need to click 'add library'?

Please advise
ProjectProperties.png
[Thumbnail for ProjectProperties.png]
project properties
ProjectPropertiesBuildPAth.png
[Thumbnail for ProjectPropertiesBuildPAth.png]
project properties build path
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i went to
window-->preferences--clicked 'project specific settings'-->gave 1.7 as attached(i cannot see 1.8 not sure how to enable that..is it is due eclipse keplon wont support 1.8???)

after saving my errors reduced to 2

how to resolve those two as well.

Please advise
ProjectSpecificSettings0.png
[Thumbnail for ProjectSpecificSettings0.png]
project specifi
ProjectSpecificSettings1.png
[Thumbnail for ProjectSpecificSettings1.png]
project specific
ProjectSpecificSettings2.png
[Thumbnail for ProjectSpecificSettings2.png]
project specifics
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good job figuring out how to get rid of most of the errors. Hint: you probably should do all your experimenting before posting. That way you don't have several posts which are now moot.

I'm in Eclipse Mars and it is Java 1.8 ready. I would advise upgrading.

I don't know the answer to the last two problems but you can try right-clicking on them and choosing Quick Fix.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm in Eclipse Mars and it is Java 1.8 ready. I would advise upgrading.



i will definitely try mars. My only concern is all my old workspaces and project i did on eclipse kepler are unusable right. I loose track of old project as i keep upgrading eclipses. This is big challenge i am facing with keeping up the learned and executed projects to a safe place and re use them when the need arises. Importing simple web webservice project in java can become most complex thing in the world sometimes which really wonders me. please advise
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't ever tried upgrading two levels (Kepler -> Mars) but I know when I upgrade one level (Luna -> Mars) Eclipse converted my workspace for me. This is only a problem if you have another workspace, like at work, that is on another version and you want to import from it. But for the most part, the new version of Eclipse should convert your workspace without a problem.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have downloaded mars and tomcat 8 and imported maven existing project without 64 previous errors. Thank you for the help.
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad I could be of service.
 
sai rama krishna
Ranch Hand
Posts: 542
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while choosing tomcat i have to hange the jre drop down selection to 1.8 instead of the default first option(work bench default JRE, i wonder what that option means) it showed as attahed.



while importing one other projet i got below error

Description Resource Path Location Type
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path index.jsp /javafirstws/src/main/webapp line 1 JSP Problem

i have to follow beloe advise to fix that as well.

actually below helped in fixing issue
http://stackoverflow.com/questions/22756153/the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build

Add a runtime first and select project properties then check server name from 'Runtimes' tab as shown in image.

JRE1.8.png
[Thumbnail for JRE1.8.png]
jre
workbenchDefault.png
[Thumbnail for workbenchDefault.png]
workbenchDefault
 
They weren't very bright, but they were very, very big. Ad contrast:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic