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
Related
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 months ago.
Improve this question
I installed my app on Android 11. But there is no folder under setting--> Storage--> Files--> Android--> data.
My app cannot create its own app-specific directory.
Is there any one have some suggestions?
You can directly create data in your own application directory, but you cannot create folders directly in other directories, because of security issues, it is not allowed to obtain the absolute path of the data.
App-specific directory on external storage
Starting in Android 11, apps cannot create their own app-specific directory on external storage. To access the directory that the system provides for your app, call getExternalFilesDirs().
Other reference: android-11-scoped-storage-permissions
On Android 11, apps cannot read or write to other apps' directories inside the Android/data folder.
Check the reference: Official Android Guide
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.
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 4 years ago.
Improve this question
I am getting java.io.FileNotFoundException on Jboss server. While debugging locally, it's working fine. I am having one PDF file which is part of the jar itself. This PDF will be send in the mail.
This jar will run on server by kjb job.
Exception is like this:-
Caused by: java.io.FileNotFoundException: file:/home/adminjboss
/bin/Kettle-3.2.0/libext/Rapi-scheduler-2.8.13_UAT.jar!
/SupplierGuide.pdf(No such file or directory).
If the file is within the jar you have to extract it, something like (untested)
File temp = File.createTempFile();
try(InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("/SupplierGuide.pdf")) {
IOUtils.copy(is, new FileOutputStream(temp));
}
If you debug locally it may function properly because you debug with an "expanded layout", i.e. you have your classes directly in the classpath.
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)
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'.