On Wed, May 21, 2008 at 03:59:59PM +0200, David Herron wrote:
> Hi, I'm looking at learning to package java apps for Ubuntu/Debian and  
> came across the cdbs thingy
>
> In there is ant.mk and ant-vars.mk and in the latter is this stanza:-
>
> JAVA_HOME = $(shell for jh in $(JAVA_HOME_DIRS); do if [ -x  
> "$$jh/bin/java" ]; then \
>        echo $${jh}; exit 0; fi; done)
> JAVACMD   = $(JAVA_HOME)/bin/java
>
> Clearly the issue is to, at compile time, find where JAVA_HOME is so  
> that...?  But is this the best way to find JAVA_HOME and what about the  
> Java alternatives?  The above code is going to stop at the first  
> /usr/lib/jvm/*/bin/java it finds and depending on the sort order of '*'  
> it might or might not be the best or desired choice on a system that has  
> several Java implementations installed.
>
> The way Java implementations are installed a /usr/bin/java and  
> /usr/bin/javac exist.  But ant requires knowing where JAVA_HOME is.
>
> I don't know how to query to find the currently set Java alternative.   
> update-java-alternatives has --list and --set but not --current.  If  
> that existed maybe JAVA_HOME could be something like:-
>
> JAVA_HOME=/usr/lib/jvm/$(shell update-java-alternatives --current)
>
> Or, am I just a confused newbie?
>
> I'm at UDS this week and can chat with doko about this.
>
> BTW I was chatting a couple days ago with an Inkscape developer - he  
> needs to compile some JNI code and needed to know how, at compile time,  
> to locate the JNI header files in the JDK.  This is the same problem, to  
> determine at compile time the current Java implementation to use.

Using different Java implementations or using alternatives are package
build time is not really what you want. You want to have reproducible
builds. That means also that you can easily reproduce a build failure.
There are far too many issues that work with one JDK and not with
another. Its always best to depend on a specific Java implementation at
build time.


Cheers,
Michael


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to