Bug 250268

Summary: cad/sweethome3d: enforce java version
Product: Ports & Packages Reporter: Rodrigo Osorio <rodrigo>
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (danfe)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
use of the correct version of java for SH3D none

Description Rodrigo Osorio freebsd_committer 2020-10-11 10:33:46 UTC
Created attachment 218659 [details]
use of the correct version of java for SH3D

When multiple versions of java are installed on the computer
javavmwrapper uses the latest one to launch SweetHome3d causing
a crash if the version is bigger than the version used to build
the port.

Find attached a patch to enforce the use of the correct
version of java by javavmwrapper based on the USE_JAVA
variable declared on the Makefile.
Comment 1 Alexey Dokuchaev freebsd_committer 2020-10-23 06:49:00 UTC
Funny, initially I couldn't reproduce it.  I have both openjdk8 and openjdk11 installed, and javavm -version reports 1.8.0_262.

Today I decided to read the manpage and found this:

>   This selection process is usually achieved through the use of
>   /usr/ports/Mk/bsd.java.mk.  However, if this is not present then javavm
>   will use its own internal selection process which is designed to behave
>   almost identically.
After I've renamed `bsd.java.mk' temporarily, it started to default to version 11, and I could reproduce the crash.  Will commit the fix shortly.

Not exactly sure what to do about the selection process not behaving "almost identically", but per my definition of "almost", either the selection logic or the manpage should adjusted.
Comment 2 commit-hook freebsd_committer 2020-10-23 08:23:30 UTC
A commit references this bug:

Author: danfe
Date: Fri Oct 23 08:23:23 UTC 2020
New revision: 553098
URL: https://svnweb.freebsd.org/changeset/ports/553098

Log:
  - Enforce JAVA_VERSION when launching javavm(1), otherwise the program
    crashes when several JDK versions are installed and javawm(1) picks
    higher version (happens when /usr/ports/Mk/bsd.java.mk is absent,
    contrary to documented selection process which is designed to behave
    almost identically WRT presence/absence of /usr/ports/Mk/bsd.java.mk
  - While here, simplify the script a bit and remove keywords and their
    expansion, they are useless for wrapper scripts

  PR:		250268
  Submitted by:	rodrigo

Changes:
  head/cad/sweethome3d/Makefile
  head/cad/sweethome3d/files/sweethome3d.sh.in
Comment 3 Alexey Dokuchaev freebsd_committer 2020-10-23 08:25:46 UTC
Should be fixed as of ports r553098, thank you.