403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.71.152.33
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/ndb/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb/include/have_java.inc
--perl
use strict;
use File::Basename;
use IO::File;
use lib "lib/";
use My::Platform;
use My::Find;

require "lib/mtr_misc.pl";

#
# Looks for java executable (/bin/java) in several locations:
# - MTR_JAVA environment variable
# - Other architecture-dependent locations (see below)
# - $PATH environment variable
#
# If java executable is found, MTR_JAVA will be set to reflect this location
# If no java executable is found, fail the test in which this is included
my $java_args = "";
my @arch_paths = ();

my $pathsep = "/";
my $bits = $ENV{MYSQL_SYSTEM_ARCHITECTURE};

# Architecture dependent paths

if(!IS_WINDOWS)
{
  push(@arch_paths, ('/usr/lib/jvm/java/bin', '/usr/lib64/jvm/java/bin'));
  push(@arch_paths, ('/usr/local/jdk/bin', '/usr/local/java/bin', '/usr/local/java/jdk/bin'));
  push(@arch_paths, ('/usr/jdk-latest/bin', '/usr/bin'));

  $java_args = "-d32";
  if ($bits == 64) {
    $java_args = "-d64";
    push(@arch_paths, ('/usr/java-local/jdk-64/bin', '/usr/local/jdk-64/bin', '/usr/local/java/jdk-64/bin'));
  }
}
else
# IS_WINDOWS
{
  if ($bits == 64) {
    push(@arch_paths, 'C:\java\jdk-64\bin');
    $java_args = "-server";
  } else {
    push(@arch_paths, 'C:\java\jdk\bin');
    $java_args = "-client"; 
  }
  push(@arch_paths, 'C:\Windows\SysWOW64');
  push(@arch_paths, 'C:\Windows\System32');
}

my @java_paths = ($ENV{JAVA_HOME} . $pathsep . "bin");
push(@java_paths, $ENV{JDK_HOME} . $pathsep . "bin");
push(@java_paths, @arch_paths);
push(@java_paths, "*"); # last resort: empty path marker for "java on PATH variable"

my $java_loc = "";
our $java_version = "";

sub java_exists {
   my ($path, $exe) = @_;

   $exe .= ".exe" if IS_WINDOWS;
   $path .= $pathsep if length($path) > 0;
   my $exists = $path . $exe;
   my $devnull = "/dev/null";
   $devnull = "NUL" if IS_WINDOWS;

   system("echo trying: $exists");
   system("\"$exists\" " . $java_args . " -version > " . $devnull);
  
   my $ret =  $exists if ($? == 0);
   if($? == 0) {
     my $ret = $exists;
     open(VER, "\"$exists\"  -version 2>&1 |");
     $java_version = <VER>;
     close(VER);
   }
   
   return $ret;
}

system("echo Looking for a suitable Java...");
foreach my $path (@java_paths) 
{
  if (!defined $path || $path eq ($pathsep . "bin")) {
    # no MTR_JAVA case
    next;
  }
  if ($path eq "*" ) {
   # java on PATH env case
   $path = "";
  }

  my $tmp = java_exists($path, "java");

  if ($tmp ne "") 
  {
     $java_loc = $tmp;
     last;
   }
}

my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
my $F = IO::File->new("$vardir/tmp/have_java_result.inc", "w") or die;
if ($java_loc eq '') {
  print $F "--die Could not find Java executable; please install Java in one of the above paths or set env MTR_JAVA to the preferred JAVA HOME;\n";
} else {
  print $F "--let \MTR_JAVA= $java_loc\n";
  print $F "--let \MTR_JAVA_ARGS= $java_args\n";
  print $F "--let \MTR_JAVA_VERSION= $java_version\n";
  print $F "--echo Found Java: '\$MTR_JAVA'\n";
  print $F "--echo Java version: '\$MTR_JAVA_VERSION'\n";
}
$F->close();

EOF

--source $MYSQLTEST_VARDIR/tmp/have_java_result.inc

Youez - 2016 - github.com/yon3zu
LinuXploit