Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java file executed in command line but not in browser

I am new to linux and connecting web pages to the server.

I am working on a project which requires a html page to execute a java file in Linux server and display the output back in a webpage.

  1. I have created a javafile which is executing fine in command line and creates a results.txt file.
  2. I have created a shell script which successfully executes the javafile in it.
  3. A html page where i wrote ajax to trigger a first.php file to execute the above shell script.

Everything is successful when I execute the php file from command line in linux, it displays test print comments in both java and shell script, it creates a file from both java code and shell code.

But when i execute from browser

Issue #1 - it doesn't create files from shell script but it displays the test print statements

Issue #2 - it doesn't execute java code at all so no file creation nor prints statements.

Could you tell me if i have to enable or change settings if i am executing these shell and java code from browser??

I have set the permissions of public_html to 777 for time being.

Error From browser:Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007fcf589ac000, 2555904, 1) failed; error='Permission denied' (errno=13) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 2555904 bytes for committing reserved memory. # An error report file with more information is saved as: # /tmp/hs_err_pid306.log

like image 592
user3554618 Avatar asked Apr 23 '26 14:04

user3554618


1 Answers

If you are using Centos there may be some issues with selinux.

The command to disable selinux is "setenforce 0" from the linux command prompt.

like image 98
jgreep Avatar answered Apr 25 '26 04:04

jgreep