Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 months ago.
Improve this question
I have found a Java application repository on GitHub which provides the application in JAR format and in the native binary format for different operating systems such as MacOS, Windows, Linux.
I am able to execute the JAR file using the java -jar command but I would like to run the native binary file so users can execute it without installing the Java in their system.
Can someone please inform me how can I run the binary file on Macos? I tried to search and found the command chmod +x name-of-binary but this command does not do anything.
I am really new to this and do not have much idea about this so any suggestion would be really helpful.
The most simple way would be to either open a terminal and manually running the binary, like so:
./<name-of-file>
This would only work if you are running the file in a user who has execution privileges on that file. if you run into trouble with priviliges, that's where I would use chmod.
If you need any more specific help, I would recommend posting the link to that GitHub repo for us to look at, and telling us what is it that it should do.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want add a file into the jar package but this is a separate file from the java program, can I run it and if I can run it, how can I run it? Can you recomment anything?
Thanks.
Not possible; java doesn't run arbitrary executables; your OS does. Java ask your OS to run an executable, but OSes generally do not have the ability to run executables from within zip files. Let alone jmod files.
If your java application can read and process the data itself (example: Render a swing JLabel object with some PNG as its image), then you can to this:
YourClass.class.getResource("open_url.png")
Will get you an inputstream for the stated file, as long as that file is in the same place that YourClass.class is - even if it is in a jar file or jmod file.
However, if you have an .exe, you'd have to extract the executable, save it to a tmp dir, and then ask the OS to run that file. Saving executables to temp dirs is a little tricky (if it's a global temp dir, some other user could overwrite your executable in the middle, and thus run its code in your process, you see how that's security-wise quite a big issue). But, you can do it. Note that this makes your app not platform independent anymore, of course.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm new to docker and want to understand on how to build a docker image that I can deploy in my organization's internal cloud
Currently, our vendor has provided us with a shell script which we use to install a java application on a VM.
Is there any way to build an image for this java application using this shell script?
Thanks.
Yes, just use
FROM <base_image>
to define the base image you want to start with (i.e. the best suited environement for you application to work: typically you would use Ubuntu 16.04, or maybe an Alpine linux distribution if you want to be more lightweight
then
RUN <shell-script>
to install you application
(note that if there are dependencies needed for the script to run (like JAVA), you will need to RUN the install steps for the dependencies before this RUN command)
and then
CMD <command-to-start-the-app>
to start the app.
A good place to start with Docker is to look up the official images of known services on github and see how they do it.
There are many images using JAVA, with a base like https://github.com/dockerfile/java
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have tried unchecking and checking that box inside windows-->preference-->compiler option-->Class file generation. Tried restarting the eclipse.But it didnt work. I am using "eclipse-jee-indigo-SR2-win32-x86_64". I have used src zip folder in jdk1.7.0_79.
I just want to write my own program, use map/list etc and debug through methods of these classes and see how it works internally.Please help
The message is complaining about your Java runtime not having debugging information. Attaching source does not fix this problem, it will only enable you to read the source. You didn't compile those classes using Eclipse, so the preference has no relevance. If you want to debug into rt.jar, you need to install and compile/run against a JDK, not a JRE, and even if you have a JDK installed, it sounds like that is not what is being used to run your Java Application. Check your Installed JREs preference page (hint: prefer only having JDKs there) and then your application's Launch Configuration to make sure it's using what you expect.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I’m new to python scripting and I need to install Java using python script . please suggest a method to do this.
Thanks all.
If i am not wrong you are looking for silent installation of Java. Here is a link that explains the same:
Silent installation of Java
Next you would want to run this command using python. For this you can use subprocess in python. Below is a link explaining it:
Using subprocess in Python
You want to display error stream too, so use the subprocess.Popen as:
process = subprocess.Popen(['command plus args as in above link'],stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = process.communicate()
out contains the output of the above command and err contains the error stream.
I would suggest you to install java from command line first, and then use this command in python script.
To install mySql or even tcl, follow similar steps,
1. Find how to install using command line
2. Execute the same command using python
Also, there may already be existing packages to do your job, if so you can use them.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am writing a Java code for Linux RHEL 5 machine. The requirement is that while sitting at machine A, I should be able to edit some files in a remote machine B. Both machine A & B are RHEL. Now the following possibilities are there. Can anyone please suggest which is better or if any other way is there:
Write a shell script to do this. Execute the shell script from A such that changes happen in B
Write a java code on A, that is able to login to B and edit files in B.
Write a java file editing utility (pattern-matching thing). Push this util on B through another java code. Execute the file edit util in B. Somehow the trigger for executing the util in B should also be given by A
Thanks
Eclipse Remote System Explorer lets you do just that: http://www.eclipse.org/tm/
You can also use java library to do that :
http://www.jcraft.com/jsch/
Check out the examples link.
It depends on your needs but I think it is easier and faster to do that with bash scripts and some linux tools like nc, telnet or ssh for instance.
With ssh is as simple as:
ssh user#remote mkdir /tmp/new_directory
I hope it helps...