![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
|
|
Desktop Environments Support for your Ubuntu desktop. Including Gnome, KDE and XFCE. |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
5 Cups of Ubuntu
![]() Join Date: Apr 2006
Beans: 21
|
Frustration with Java and gcj
Hi all,
I'm a Java developer, relatively new to Ubuntu, and I am finding the Ubuntu java packaging a complete nightmare. I'm mainly writing here out of frustration; though if others can point out an easy way to configure Java tools without doing all the work myself, I'd be a happy man The basic problem is that while Ubuntu allows you to install Sun's Java, it defaults to gcj all over the place, and there is no easy way to change this. Surely if someone has chosen to install Sun's Java, Ubuntu could accept that decision and actually use it? I understand the politics behind gcj, and I support the fact that it is the default java environment - the default option should be the completely free one. However, gcj is still severely limited in several areas - not least, the fact that it doesn't support Java 1.5 language features. This makes it not very useful, for me at least, in my day-to-day work. However, in Dapper I can't get rid of the damn thing. Every java tool has gcj as a prerequisite, as well as a pile of other related libraries. Surely there is some way in apt for the system to recognise that I *have* a working JVM, and don't need to download all this extra stuff? Worse, despite using the update-alternatives and update-java-alternatives mechanisms, many tools still use gcj. Eclipse is a case in point - as bundled with Ubuntu, it completely ignores the update-alternatives symlinks and uses gcj, unless you manually edit a config file. This may be ok if you are only doing gcj development, and not using a single tool or plugin that relies on Java 1.5 features - but it's not much use for the rest of us. Ditto anything that looks for JAVA_HOME to identify a JVM - update-alternatives doesn't set JAVA_HOME, so such tools are also out of luck. Sigh. Suse used to have this working much more easily - it had a script to set JAVA_HOME and related environment variables on the fly, and then "/usr/bin/java" and related tools were scripts that interrogated JAVA_HOME and chose the right JVM for the current shell. Changing JVM could be done on a per-script basis. It looks like Suse 10 has moved to the update-alternatives mechanism however. Pity the person who wants to run two different JVMs at once... In the end, I've given up on apt for my Java tools. I use it to install and update Java itself, and I use java-package to install other things like beta versions of Java 1.6, but I'm installing everything else by hand. That way I know they work, and won't be mysteriously running gjc behind the scenes, and I can tweak their startup scripts to run the right JVM, without worrying about collisions with automatic updates. I know the real culprit is probably Sun, with their annoying restrictions on Java packaging - if they open-sourced Java, half the problem would go away. But given the fact that Ubuntu now allow you to install Sun's java, it'd be nice if it actually worked. :-/ - Korny |
|
|
|
|
|
#2 |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
Location: Sydney, Australia
Beans: 200
Ubuntu 7.10 Gutsy Gibbon
|
Re: Frustration with Java and gcj
[edit] never mind... didn't read your entire post [/edit]
__________________
Insanity is all in the mind... |
|
|
|
|
|
#3 |
|
A Carafe of Ubuntu
![]() |
Re: Frustration with Java and gcj
where does it revert to gcj mysteriously?
I've set the env_vars in the /etc/environment and no issues as such. |
|
|
|
|
|
#4 |
|
5 Cups of Ubuntu
![]() Join Date: May 2006
Beans: 38
|
Re: Frustration with Java and gcj
sudo update-alternatives --config java
|
|
|
|
|
|
#5 |
|
5 Cups of Ubuntu
![]() Join Date: May 2006
Beans: 38
|
Re: Frustration with Java and gcj
recommend doing
sudo update-alternatives --all to check every alternative |
|
|
|
|
|
#6 | |
|
5 Cups of Ubuntu
![]() Join Date: Apr 2006
Beans: 21
|
Re: Frustration with Java and gcj
Quote:
Mind you, as per my previous rant it only works for some programs. |
|
|
|
|
|
|
#7 |
|
Way Too Much Ubuntu
![]() |
Re: Frustration with Java and gcj
You claim to be a Java developer, and yet it seems you haven't set up java before (no hard feelings).
If you don't want to update alternatives, or have problem with it, set JAVA_HOME in your bashrc or the global one, and prepend it at the same place to the PATH variable. |
|
|
|
|
|
#8 | |
|
5 Cups of Ubuntu
![]() Join Date: Apr 2006
Beans: 21
|
Re: Frustration with Java and gcj
Quote:
And yes, you can manually set JAVA_HOME etc. in /etc/environment - but it doesn't keep in sync with update-alternatives, and comes under the category of "guru knowledge" in my opinion - I'd never even heard of this file A summary of what I've observed so far: - You can set your JVM in (at least) 3 ways: (A) - running "update-alternatives" or "update-java-alternatives", which set symlinks from /usr/bin/java* -> /etc/alternatives/java* -> /usr/lib/j2sdk...etc (B) - setting JAVA_HOME, JRE_HOME, JDK_HOME etc to the correct paths, either in /etc/environment or in a shell script or .bashrc or the like. (C) - modifying /etc/eclipse/java_home and/or /etc/jvm (or other obscure config files) - Java tools in the ubuntu repositories tend to use some combination of (A) (i.e. look for java on the path) or (C) (i.e. read an obscure config file). Those that use (A) obey update-alternatives settings, those that use (C) don't. - Java tools you install yourself tend to use (A) or (B) or both - i.e. Tomcat uses JAVA_HOME if it's set, otherwise it looks for java on the path. This seems to be fairly standard behaviour. (A) works with update-alternatives, (B) doesn't. None of these options allow you to choose a JVM in Ubuntu without knowing which magic config files to edit, or which command-line tools to run. And there are about 1000 howtos on the net about *which* config files and/or command line tools you should run - most of them wrong, or at least incomplete. - Korny |
|
|
|
|
|
|
#9 | |
|
Gee! These Aren't Roasted!
![]() |
Re: Frustration with Java and gcj
While using the Dapper flight series I installed Sun Java by following the instructions in the Wiki to create a deb package from the downloadable bin file. To install the updated version in Add/Remove will I have to uninstall the other first?
I went ahead and installed it. And this is what my java config looks like. Which one do I select? #1 or #4. Quote:
I use Moneydance financial software which requires Java. I had to use the installer with Java. It placed JRE1.5.04 in the Moneydance install folder. It doesn't see the newer java version. I'll inquire about that with them. |
|
|
|
|
|
|
#10 |
|
Gee! These Aren't Roasted!
![]() |
Re: Frustration with Java and gcj
[BUMP] Dang!
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|