Today, I'm going to share a problem which I think it's quite common:
- importing Java Maven projects into Eclipse and expecting Eclipse to just work with it.
You do:
1) sync from source control
2) import existing maven projects to eclipse
3) see many red errors in Eclipse.
4) yeah , I forgot to set the Maven settings file
5) still some projects are failing
6) try to fix each problem 1 by 1
Why does it happen like that?
Most common is that it will set a Java Compiler version which is from the POM.xml but then the JRE environment specified could be... just not right. So your POM.xml says "compiler version 1.7", but the Maven projects you import are automatically assigned Java1.5...
So errors like
- You cannot use @Override here
or for java1.7
- new ArrayList<> constructor not found (or not valid expression).
So you have to go to each project, reconfigure build path parameters to point to JRE1.7 manually, even though you have specified JDK1.7 as installed JDK.
Imagine fixing this manually for 20-50 projects (you've just been moved to moderately progressed project)
Even if you explicitly set the Maven settings in the Preferences menu, you would not solve your problem.
The single solution is to:
1) delete all projects (
only
from Eclipse )
2) reimport them, because NOW you have set the Maven settings BEFORE the importing...
Just crazy... not being able to automatically adapt the projects to the new maven settings file... not even "clean" and "maven update" help...
Best wishes,
Leni Kirilov
Showing posts with label jdk. Show all posts
Showing posts with label jdk. Show all posts
Friday, June 07, 2013
Wednesday, September 01, 2010
JDK 7 new features (part 1)
Hi there,
We all know Java. Many love it, some dislike it, other actually hate it... and if they knew its weaknesses and flaws as I know some of them, well, they'd pity all the Java developers for choosing such a fragile platform and language...
So basically , before you thought I hate Java, the thruth is just the opposite - check this blog's name :) - but I admit that Java has some veeeery bad treats and design flaws.
But why am I talking about Java flaws in a posting called "Java 7 new features" -- well , because they(the guys behind Java) try to address some of these problems , I'm also going to point some of them to you..
This list is not ordered by me - everywhere I look these features are presented in this order. I'll keep it that way for consistency.
Feature: 64/32 bit pointers support
-- why store 32bit pointers in 64bit space, when you don't need it. The JVM will be more agile and not create empty spaces in the pointers, so less space will be required, which will help the traffic more than a local system with gigabytes of RAM. Performance boost.
Feature: Garbage-first Garbage Collection
- kills the young fast-dying generation first. and preserves objects that have survived the wipe a few times.
Result: more GC options and strategies -- performance boost.
Feature: dynamic languages in JVM
-- All can agree that Dynamic languages have big future ahead of them and that's a good reason that Java should try to adopt them and try to run them natively on a JVM. Thus making the JVM something like a universal VM for different kinds of languages. Imagine the freedom to combine different languages and techniques easily with native support and not some simulators.... no performance problems ... no interoperability problems... I really hope this is going to be implemented very professionally.
Added support for lambda functions, which could revolutionize some known patterns in the Java world - creation of an anonymous class for an interface like MouseListener and so on - now you can create a lambda implementation, pass it as an argument and inside it can be executed. This will make our Java a more interesting place. The anonymous-class design that was being forced because of the lack of such a feature and it's not intuitive at all. Let's see where this will get us.
Feature: Java modularity - Project Jigsaw
This project, in my opinion, will be an improvement, which will improve our Java experience. But what exactly is the problem? What do you mean with "Java modularity" ? Java is already modular, some will say... Well, it isn't.
Just check your local JRE installation and see in the \lib\ directory the rt.jar (rt = runtime). Notice the size - using latest JDK 1.6 Update 21, the rt.jar is around 47 MB.
Yeah, 47 MB and that's a module... yeah right. Nice design, guys! Many classes must be written with lots of lines to fill those 47 MB and believe me - these 47MB in rt.jar are all classes. Who wants to say how many millions of code...
But why when I only use java.net and java.lang should my JVM also load SWING and java.beans and javax.xml ... The sad reason is that all of them are all TIGHTLY coupled...
Somehow, somebody let it all loose control and everybody started pushing shit in this .jar file... well it works, so who cares? It's not modular... again, who cares? You can't easily extract a piece of it and place it elsewhere. You can't manage your JVM RAM requirements because of required modules being all stick together and you can't separate them.
Image that you can modify your JVM depending on your business case !
Well, project JIGSAW is trying to solve exactly this problem - separating all swing, applet etc modules into separate sub-projects and decomponentizing the rt.jar into several (hundred?) jar files.
I imagine something like a ( JVM + OSGi ) ... yeah :)
I wish the developers good luck, because of the issues that could arise, and I think it's not a trivial job.
Remember they also have to maintain the backwards operability somehow...
...
I see that this post has become very long, so I'm going to continue it later.
Feel free to comment, because my view on a topic could be very wrong, but I'd love if you start a discussion. Especially when the topic is Java :)
Leni Kirilov
We all know Java. Many love it, some dislike it, other actually hate it... and if they knew its weaknesses and flaws as I know some of them, well, they'd pity all the Java developers for choosing such a fragile platform and language...
So basically , before you thought I hate Java, the thruth is just the opposite - check this blog's name :) - but I admit that Java has some veeeery bad treats and design flaws.
But why am I talking about Java flaws in a posting called "Java 7 new features" -- well , because they(the guys behind Java) try to address some of these problems , I'm also going to point some of them to you..
This list is not ordered by me - everywhere I look these features are presented in this order. I'll keep it that way for consistency.
Feature: 64/32 bit pointers support
-- why store 32bit pointers in 64bit space, when you don't need it. The JVM will be more agile and not create empty spaces in the pointers, so less space will be required, which will help the traffic more than a local system with gigabytes of RAM. Performance boost.
Feature: Garbage-first Garbage Collection
- kills the young fast-dying generation first. and preserves objects that have survived the wipe a few times.
Result: more GC options and strategies -- performance boost.
Feature: dynamic languages in JVM
-- All can agree that Dynamic languages have big future ahead of them and that's a good reason that Java should try to adopt them and try to run them natively on a JVM. Thus making the JVM something like a universal VM for different kinds of languages. Imagine the freedom to combine different languages and techniques easily with native support and not some simulators.... no performance problems ... no interoperability problems... I really hope this is going to be implemented very professionally.
Added support for lambda functions, which could revolutionize some known patterns in the Java world - creation of an anonymous class for an interface like MouseListener and so on - now you can create a lambda implementation, pass it as an argument and inside it can be executed. This will make our Java a more interesting place. The anonymous-class design that was being forced because of the lack of such a feature and it's not intuitive at all. Let's see where this will get us.
Feature: Java modularity - Project Jigsaw
This project, in my opinion, will be an improvement, which will improve our Java experience. But what exactly is the problem? What do you mean with "Java modularity" ? Java is already modular, some will say... Well, it isn't.
Just check your local JRE installation and see in the \lib\ directory the rt.jar (rt = runtime). Notice the size - using latest JDK 1.6 Update 21, the rt.jar is around 47 MB.
Yeah, 47 MB and that's a module... yeah right. Nice design, guys! Many classes must be written with lots of lines to fill those 47 MB and believe me - these 47MB in rt.jar are all classes. Who wants to say how many millions of code...
But why when I only use java.net and java.lang should my JVM also load SWING and java.beans and javax.xml ... The sad reason is that all of them are all TIGHTLY coupled...
Somehow, somebody let it all loose control and everybody started pushing shit in this .jar file... well it works, so who cares? It's not modular... again, who cares? You can't easily extract a piece of it and place it elsewhere. You can't manage your JVM RAM requirements because of required modules being all stick together and you can't separate them.
Image that you can modify your JVM depending on your business case !
Well, project JIGSAW is trying to solve exactly this problem - separating all swing, applet etc modules into separate sub-projects and decomponentizing the rt.jar into several (hundred?) jar files.
I imagine something like a ( JVM + OSGi ) ... yeah :)
I wish the developers good luck, because of the issues that could arise, and I think it's not a trivial job.
Remember they also have to maintain the backwards operability somehow...
...
I see that this post has become very long, so I'm going to continue it later.
Feel free to comment, because my view on a topic could be very wrong, but I'd love if you start a discussion. Especially when the topic is Java :)
Leni Kirilov
Monday, May 24, 2010
JDK 1.6 installation problems
Today's topic is Java Developers' Kit.
I've had a peculiar problem with JDKs. I wanted to install the latest version of JDK 1.6 update 18 at the time, but I also wanted to have JDK 1.5 so that I test my application with different compilers and runtime environments.
However there was some sort of problem with it (the source of it, I am unaware till this day) that caused my Windows unable to detect my successful installation. I checked that on this special site java.com
I could also check it with an applet in a page - it said that I need to install java...
1. First idea - reinstall
I thought that my register was messed-up and ran CCleaner to clean it. That didn't help.
I decided to reinstall it and here's my first surprise:
After the successful uninstall and running CCleaner again (just to be sure), and decided to reinstall the JDK
I've got a very "funny" error message (something like this - I don't remember the correct caption):
"Installer has detected that you have JDK installed. Do you want to repair/reinstall it?"
If you click NO - the installer shuts down.
If you click YES - the following message appears:
"You don't have JDK installed on your machine!"
Holly shit ! Isn't that just a bit contradicting...
Obviously, the algorithm at the beginning isn't the same as the one at the end...
2. Second idea - install older version
OK. I cannot override this incorrect installation. So let's try to downgrade it a bit.
I decided to try JDK 1.6 update 17. When I run it it said:
"You have already installed a higher version of JDK" - installation finished!
Thank you very much, smart installer!
3. Third idea - ask Google
"OK stop trying to be a smart ass. There has to be somebody with the same problem that has a solution!"
was my thought.
Yeah, right... After many hours of searching and "smart solutions", none of them helped me.
I intend not to list them here... just too many and very customized...
One of them seemed promising to me.
Google helped me find a tool and step-by-step solution.
4. Forth idea - clean up registry
I absolutely had no other choice than to try and clean my registry.
Including backing up my registry and using a free tool called "JavaRA" that could help me maintain my system and Java versions and updates very well... well I tried it and it didn't help... I was very disappointed but maybe my expectations were just too great.
5. No idea - desperation
I was quite desperate that my JDK ws not correctly installed. My applets weren't working. Eclipse stopped working at a certain moment. NetBeans - too. I even had to use system restore... a total disaster.
And I just migrated to Windows 7 Pro 64bit version... which seemed nice for user but apparently not for JAVA users... Using Win XP I didn't have such problems (although I think I had a similar problem a few years ago).
...
but I had a workaround!!
6. The workaround - JDK 1.7 unofficial!
Well, I was lucky I accidentally installed JDK1.7 which is still unofficial and doesn't overwrite the latest JDK 1.6. So when I installed and played around with PATH and JAVA_HOME variables and Eclipse and NetBeans configurations, I was able to continue with my Java project development.
But I was still unsatisfied, because this is just a workaround !
I've had a peculiar problem with JDKs. I wanted to install the latest version of JDK 1.6 update 18 at the time, but I also wanted to have JDK 1.5 so that I test my application with different compilers and runtime environments.
However there was some sort of problem with it (the source of it, I am unaware till this day) that caused my Windows unable to detect my successful installation. I checked that on this special site java.com
I could also check it with an applet in a page - it said that I need to install java...
1. First idea - reinstall
I thought that my register was messed-up and ran CCleaner to clean it. That didn't help.
I decided to reinstall it and here's my first surprise:
After the successful uninstall and running CCleaner again (just to be sure), and decided to reinstall the JDK
I've got a very "funny" error message (something like this - I don't remember the correct caption):
"Installer has detected that you have JDK installed. Do you want to repair/reinstall it?"
If you click NO - the installer shuts down.
If you click YES - the following message appears:
"You don't have JDK installed on your machine!"
Holly shit ! Isn't that just a bit contradicting...
Obviously, the algorithm at the beginning isn't the same as the one at the end...
2. Second idea - install older version
OK. I cannot override this incorrect installation. So let's try to downgrade it a bit.
I decided to try JDK 1.6 update 17. When I run it it said:
"You have already installed a higher version of JDK" - installation finished!
Thank you very much, smart installer!
3. Third idea - ask Google
"OK stop trying to be a smart ass. There has to be somebody with the same problem that has a solution!"
was my thought.
Yeah, right... After many hours of searching and "smart solutions", none of them helped me.
I intend not to list them here... just too many and very customized...
One of them seemed promising to me.
Google helped me find a tool and step-by-step solution.
4. Forth idea - clean up registry
I absolutely had no other choice than to try and clean my registry.
Including backing up my registry and using a free tool called "JavaRA" that could help me maintain my system and Java versions and updates very well... well I tried it and it didn't help... I was very disappointed but maybe my expectations were just too great.
5. No idea - desperation
I was quite desperate that my JDK ws not correctly installed. My applets weren't working. Eclipse stopped working at a certain moment. NetBeans - too. I even had to use system restore... a total disaster.
And I just migrated to Windows 7 Pro 64bit version... which seemed nice for user but apparently not for JAVA users... Using Win XP I didn't have such problems (although I think I had a similar problem a few years ago).
...
but I had a workaround!!
6. The workaround - JDK 1.7 unofficial!
Well, I was lucky I accidentally installed JDK1.7 which is still unofficial and doesn't overwrite the latest JDK 1.6. So when I installed and played around with PATH and JAVA_HOME variables and Eclipse and NetBeans configurations, I was able to continue with my Java project development.
But I was still unsatisfied, because this is just a workaround !
A developer must never be satisfied with a mere workaround!
Wednesday, May 12, 2010
Just a reminder for my future posts
I'll write about the following topics in no particular order, unless somebody says explicitly that they are interested in a topic and I'll post it ASAP.
I'd like to remind myself to document my thoughts regarding these topics:
These topics will follow:
I'd like to remind myself to document my thoughts regarding these topics:
These topics will follow:
JDK 7 new featureswhat I likewhat I don't likeJDK 1.6 installation problemshints how to solve the problems- Sony PRS-600 Touch - my brand new reader (and all the fuss regarding getting it)
- review
- some hints, tips and tricks
- problems
- conversion tools
Windows 7connecting to networkcontrol panel (Back) button navigationsome bugs of my Dell Inspiron LaptopDVDstrange noiseEclipse debuggingNetBeans 6.8 bugsswing editor bugs - needs to be reportedmain class problemLaptop battery preservation tipsbecause what I have done so far has proven me right - thoughts from experience- Internet Browsers
- Opera thoughts
- Chrome
- Firefox
- IE
- Google Chrome OS
- Android
Skype time stamp bugHDD partitioning problemshow not to make your data inconsistent because of pure mistake or lack of knowledgeTest-Driven Development
L.K.
Subscribe to:
Posts (Atom)