Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been trying to get Java working on my FreeBSD 7.1 server. I just want the runtime, since the JDK drags all kinds of unnecessary dependencies with it, and I just need it to run a jar file periodically. I've installed the FreeBSD-supported diablo-jre, but whenever I try to run it, I get a:

/usr/local/diablo-jre1.6.0/bin/java: 2: Syntax error: "(" unexpected

So what to do?

share|improve this question
add comment

3 Answers

file /usr/local/diablo-jre1.6.0/bin/java

Will probably tell you that java is actually a shell script that sets up an environment and launches the real JRE

share|improve this answer
    
Yeah. Could be wrong shell messing up the script –  svrist May 1 '09 at 19:01
    
It does not appear to be so – the command returns: /usr/local/diablo-jre1.6.0/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), for FreeBSD 7.0 (700055), dynamically linked (uses shared libs), FreeBSD-style, not stripped –  mikl May 2 '09 at 9:19
    
Weird, try strace'ing it (or the FreeBSD alternative, truss ?) –  Dave Cheney May 3 '09 at 3:14
    
Ok, I've tried with truss (no strace) and it gives this result: dpaste.com/hold/41024 – I'm not a real expert into such things, but it looks like there's something completely wrong with the Java binary. –  mikl May 5 '09 at 7:46
add comment
up vote 4 down vote accepted

Ah, I've figured it out. For all this time, I've been trying to run the amd64 version on a machine that's still running i386. Mea culpa.

So to install Java on your FreeBSD server with as few depedencies as possible:

  • Download the tarball (make sure to pick the one under the tarballs header, and for the correct FreeBSD version and platform) from The FreeBSD foundation's Java downloads.
  • Put the downloaded file in /usr/ports/distfiles/
  • # cd /usr/ports/java/diablo-jre16
  • # make config install clean
  • Be sure to disable all optional components from the configuration screen.
  • Let the installation run its course and be happy :)
share|improve this answer
1  
Wow, and the prize of worse error message goes too ... FreeBSD! –  Dave Cheney May 5 '09 at 8:37
add comment

I used the last JRE version for Windows, installed in my home directiry under .wine. Then I run java -jar program_name.jar from command line in a shell, and it's OK.

Program runs perfectly for me.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.