Opened 16 years ago

Closed 10 years ago

#14306 closed defect (invalid)

jython won't build because it wants Java 1.1

Reported by: pydave@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc:
Port: jython

Description

I tried to install Jython and it fails because it wants Java 1.1, but I use Java 1.5

Jython has only the universal variant, is there a way for me to tell port to build with Java 1.5?

$ which java
/usr/bin/java

$ which javac
/usr/bin/javac

$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)

$ javac -version
javac 1.5.0_13
...
$ sudo port install jython
...
--->  Building jython
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_jython/work/jython-2.1" && ant dist || ant jar " returned error 1
Command output: 
init:
     [echo] --- Build environment for jython ---
     [echo] --- Flags (Note: If the {property name} is displayed,
     [echo] --- then the component is not present)

     [echo] --- Optional Libraries ---
     [echo] java2 coll  = true
     [echo] servlet     = ${servlet.present}
     [echo] readline    = ${readline.present}
     [echo] oracle      = ${oracle.present}
     [echo] informix    = ${informix.present}
     [echo] mysql       = ${mysql.present}
     [echo] postgresql  = ${postgresql.present}
     [echo] jndi        = true
     [echo] jdbc        = true
     [echo] jdbc3.0     = true

prepare:

parser:

compile:
    [javac] Compiling 302 source files to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_jython/work/jython-2.1/build
    [javac] javac: target release 1.1 conflicts with default source release 1.5

BUILD FAILED
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_jython/work/jython-2.1/build.xml:138: Compile failed; see the compiler error output for details.

I initially tried this in MacPorts 1.520, but then ran selfupdate to 1.600 and had the same result.

I have: iBook G4 1.33 GHz - OSX 10.4.11

Change History (8)

comment:1 in reply to:  description Changed 16 years ago by pydave@…

Managed to get Jython running. There are some problems with the packages initial set up (the jython script is wrong). Otherwise you just have to change the jdk to one you actually have. (Although, installing 1.1 might have worked. Regardless, the lowest version I have is 1.3, so nuts to that.)

What I did:

# install jython to get the build.xml file (this command will fail)
sudo port install jython

# Modify build.xml to use 1.4 instead of 1.1 (there's only one instance)
sudo vim /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_jython/work/jython-2.1/build.xml +/1.1

# change current jdk
# I used script from here: http://www.macosxhints.com/article.php?story=20060121171126988
# The following code should work, but is UNTESTED!
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo ln -fhsv  1.4 CurrentJDK
cd -

# install again (this command should succeed)
sudo port install jython

But, Jython can't cache its packages.

$ jython
*sys-package-mgr*: can't create package cache dir, '/opt/local/share/java/cachedir/packages'
Jython 2.2a0 on java1.4.2_16 (JIT: null)
>>> from java import *
Traceback (innermost last):
  File "<console>", line 1, in ?
ImportError: no module named java

So you have to change the cache dir:

# create a cache dir
mkdir -p /tmp/jython/cachedir

# tell jython where to go and to accept parameters (so we can run scripts like "jython app.py")
# replace this line: CLASSPATH=/opt/local/share/java/jython.jar java org.python.util.jython
# with this one: CLASSPATH=/opt/local/share/java/jython.jar java -Dpython.cachedir=/tmp/jython/cachedir org.python.util.jython $*
sudo vim `which jython`

Now you should be able to run jython programs like this:

#! /usr/bin/env jython
from java.lang import Integer
print Integer(5).intValue()

So:

  • Can the jython script (/opt/local/bin/jython) be updated?
  • Can the build.xml file be set to use java 1.4?
  • Can port be set to build with a specific version of java (instead of the user changing their symlink)?

Thanks,
-David

comment:2 Changed 15 years ago by blb@…

Milestone: Port Bugs

comment:3 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:5 Changed 14 years ago by jmroot (Joshua Root)

Keywords: java jython build error version removed
Port: jython added

comment:6 Changed 14 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to singingwolfboy@…

comment:14 Changed 10 years ago by jmroot (Joshua Root)

Owner: changed from singingwolfboy@… to macports-tickets@…

comment:15 Changed 10 years ago by pydave@…

This is 7 years old and is now probably invalid. I don't even use a mac anymore. Go ahead and close it.

comment:16 Changed 10 years ago by mf2k (Frank Schima)

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.