-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
19, 20
-
x86_64
-
os_x
ADDITIONAL SYSTEM INFORMATION :
macos version 12.2; OpenJDK version 20.0.1 or version 19.0.2
A DESCRIPTION OF THE PROBLEM :
When running an application created by jpackage, searching for the current working directory returns "/".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Generate the installation of an application (with jpackage) which searches for its execution directory.
2) Install the app.
3) Launch the app to check what it found.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The absolute path to the application's runtime directory.
---------- BEGIN SOURCE ----------
public class Test {
public static void main (String[] args) {
String oneWay;
String oneOtherWay;
String resultFilePath;
try {
oneWay = new java.io.File( "." ).getCanonicalPath();
oneOtherWay = System.getProperty("user.dir");
//As the console is not supported under macos with jpackage applications the result is saved in the file /Users/.../tmp/resultFile.txt
resultFilePath = System.getProperty("user.home") + "/tmp/resultFile.txt";
BufferedWriter writer = new BufferedWriter(new FileWriter(resultFilePath));
writer.write(" oneWay : \"" + oneWay + "\"\n oneOtherWay : \"" + oneOtherWay + "\"\n");
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
macos version 12.2; OpenJDK version 20.0.1 or version 19.0.2
A DESCRIPTION OF THE PROBLEM :
When running an application created by jpackage, searching for the current working directory returns "/".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Generate the installation of an application (with jpackage) which searches for its execution directory.
2) Install the app.
3) Launch the app to check what it found.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The absolute path to the application's runtime directory.
---------- BEGIN SOURCE ----------
public class Test {
public static void main (String[] args) {
String oneWay;
String oneOtherWay;
String resultFilePath;
try {
oneWay = new java.io.File( "." ).getCanonicalPath();
oneOtherWay = System.getProperty("user.dir");
//As the console is not supported under macos with jpackage applications the result is saved in the file /Users/.../tmp/resultFile.txt
resultFilePath = System.getProperty("user.home") + "/tmp/resultFile.txt";
BufferedWriter writer = new BufferedWriter(new FileWriter(resultFilePath));
writer.write(" oneWay : \"" + oneWay + "\"\n oneOtherWay : \"" + oneOtherWay + "\"\n");
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8226904 current working directory wrong running jpackage app
- Resolved
-
JDK-8257979 [macos]:jpackage's working directory is different from javapackager
- Closed