Copying file into root directory [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a .bin file and need to copy it into a directory with root permission on an Ubuntu machine. How to do this operation in Java?

You can use:
String user = System.getProperty("user.name");
To check if the user name is 'root' and proceed or tell him/her to log in as root and relaunch the application*.
Also you can launch a process from java:
Process proc = Runtime.getRuntime().exec("./something.sh");
Doing in that script that it copies that file to desired path and with the setuid bit properly setted:
chown root:root something.sh
chmod 4755 something.sh
You could run it as root.
Anyway usually is not a good idea to write in '/'. Are you sure you want to do it?
PD: I thought it was an desktop application, not webapplication. User in this case should be always something like 'tomcat'.

Related

Why can't CMD locate this file using the correct file path? (Google Play's PEPK) [closed]

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 days ago.
Improve this question
I'm attempting to generate and upload a new app signing key from Java keystore via Google Play's PEPK tool. When running the provided command and after typing in my keystore passwords I receive the following message:
cmd error
The file/argument in question is:
argument
I'm using Java version 19.0.2 on Windows 10.
I've checked the path multiple times (copied/pasted) in Explorer and can find the file without any issues.
The .keystore file is not read-only either.
Why can't CMD locate this file using the correct file path?
Have I missed something?
Following GooglePlay's instructions, I also downloaded the PEPK.jar tool. Changed all the arguments as required. I'm expecting to generate a .ZIP file which will then be uploaded to my GooglePlay console account in the App integrity section. Unable to proceed any further due to baffling error.

Unable to execute native binaries file in MacOS? [closed]

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.

exe exported problem to open on other computers [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm a beginner in Java. I completed programing for "Triangle Calculator", exported it to JAR with Eclipse, and then turned it to exe with Launch4j. The problem is, the exe only works on my own computer and when I send it to others, Defender anti-virus pops up and also pops up an error. This is the error:
Windows cannot access the specified device, path, or file. You may not
have the appropriate permissions to access the item.
This is a problem on their computer, not yours.
They need to talk to those who set these restrictions and learn how to do it according to their policy.

Path of linux home in spring mvc property file [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have deployed a java web application to the tomcat in Linux server. The application used to save and retrieve files like images, xls files etc. I have specified the path in the property file of java application. Unfortunately the application is not storing the files on the location which i have given in property files. Can someone help me to correct the property file ?
base_path=\\home\\TestAppUploads\\
sectionImagePath=SectionImages
questionImages=QuestionImages
answerDescrImages=AnswerDescrImages
optionImages=OptionImages
userImages=UserImages
announcementImages=AnnouncementImages
This is just my first tought: have you tried the normal slash?
Because linux uses different slashes in path.
For example: base_path=/home/testinguser
I know this is a property file but if you want to handle this kind of problem inside your
Java code you might want to use File.separator
But it would be helpfull if you could paste here the error log

My program cannot detect referred jar [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
this is my projects's hierarchy
I'm currently doing a project, and one of the function is to play videos.
So, i'm using dsj.jar to play the videos..
It works perfectly when running using eclipse, but after export it into .jar,
the video won't play.
So, i guess, i don't have problem in defining the resource path or import the jar
(built path -> add external jar).
But why the video won't play after I export it into runnable jar?
If you run your jar outside eclipse, you need to specify the classpath, i.e. the jars that your jar depends on.
https://en.wikipedia.org/wiki/Classpath_(Java)

Categories