Closed Clinale closed 6 months ago
Is it the first time you installed PDF4Teachers ? Can you try to delete (save a backup) the data folder of PDF4Teachers that can be found with this path: %APPDATA%\PDF4Teachers
.
If the issue persists, you can try to start the app in a shell to see if there is any errors. To do so, go to the install directory of PDF4Teachers and run the fileruntime\bin\PDF4Teachers.bat
.
Based on your guidance, I have found the settings.yml
in the data folder %APPDATA%/Roaming/PDF4Teachers
.
In the settings. yml
file, I noticed a configuration item called language.
However, although I have already selected English language when starting PDF4Teachers firstly, the language
item in settings. yml
is still empty. I think this is why every time I start PDF4Teachers, I enter the language selection window, so I manually configure the language
items in the settings. yml
file to English
, and then restart PDF4Teachers. After doing that, the language selection window no longer appears, and I can successfully enter the PDF4Teachers main window.
Based on the above description, I believe that when installing and starting PDF4Teachers for the first time, although there is a language selection window, the results selected by the user were not successfully written to the settings. yml
file for some reason. I believe this may be due to an unknown bug. My system configuration is Windows 10, 64 bit machine
.
I guess the app sort of "crashed" right before updating the settings.yml file.
The language field in settings.yml should be set to en_us
. In fact, English
is not recognized, but leads the app to default to en_us
.
You might try to reproduce the issue with the shell opened to see if there is a logged error when the app is disappearing.
If the issue persists, you can try to start the app in a shell to see if there is any errors. To do so, go to the install directory of PDF4Teachers and run the file
runtime\bin\PDF4Teachers.bat
.
Now that you fixed the issue, are you still able to edit settings and/or change the app language in the settings ?
Running PDF4Teachers. bat
from the command line does not solve this problem.
I configure the lanuage
item to ''
in the setting.yml manually, and run the PDF4Teachers.bat
in the powershell.
Because I set language
item to empty in the settings.yml, the language selection window appears. When I select the English language and click Apply
, the language selection window disappears, there is nothing to output, and the cmdline in powershell stuck.
The following is screenshot:
If I run the PDF4Teachers from source code using command .\gradlew.bat --info run
, the same problem occurs.
The following is the command output:
09:10:07.575 INFO Main main() Starting PDF4Teachers 1.4.2-dv1 | Java 17.0.9 on JFX 17+18 (amd64) on Windows 10 10.0 09:10:07.587 INFO Main main() Run mode: dev | Log level: trace 09:10:07.664 DEBUG LockManager registerInstance() Executing with toOpenPath = [] 09:10:07.694 DEBUG LockManager registerInstance() Instance locked: true 09:10:07.822 DEBUG TR getBundleByLocaleInCode() Loading locale en_US from code... 09:10:07.834 DEBUG TR getBundleByLocaleInCode() Loading locale en_US from code... 09:10:07.846 DEBUG LogsOutputStream onLineAdded() SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 09:10:07.847 DEBUG LogsOutputStream onLineAdded() SLF4J: Defaulting to no-operation (NOP) logger implementation 09:10:07.847 DEBUG LogsOutputStream onLineAdded() SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 09:10:09.878 DEBUG LanguagesUpdater lambda$update$5() updating language with response code 200 09:10:09.912 DEBUG LanguagesUpdater lambda$update$5() Listing languages : 09:10:09.917 DEBUG LanguagesUpdater lambda$update$5() Language{urls={fr-fr.txt=https://api.pdf4teachers.org/startupdate/languages/fr-fr%3B1.2.1%3B1%3BFran%C3%A7ais%20France/fr-fr.txt, fr-fr.odt=https://api.pdf4teachers.org/startupdate/languages/fr-fr%3B1.2.1%3B1%3BFran%C3%A7ais%20France/fr-fr.odt, fr-fr.png=https://api.pdf4teachers.org/startupdate/languages/fr-fr%3B1.2.1%3B1%3BFran%C3%A7ais%20France/fr-fr.png, fr-fr.pdf=https://api.pdf4teachers.org/startupdate/languages/fr-fr%3B1.2.1%3B1%3BFran%C3%A7ais%20France/fr-fr.pdf}, release=1.2.1, version=1, name='fr-fr', displayName='Français France'} 09:10:09.917 DEBUG LanguagesUpdater lambda$update$5() (Already existing) 09:10:09.918 DEBUG LanguagesUpdater lambda$update$5() Language{urls={it-it.png=https://api.pdf4teachers.org/startupdate/languages/it-it%3B1.2.1%3B2%3BItaliano%20Italia/it-it.png, it-it.txt=https://api.pdf4teachers.org/startupdate/languages/it-it%3B1.2.1%3B2%3BItaliano%20Italia/it-it.txt}, release=1.2.1, version=2, name='it-it', displayName='Italiano Italia'} 09:10:09.918 DEBUG LanguagesUpdater lambda$update$5() (Already existing) 09:10:14.056 DEBUG TR getBundleByLocaleInCode() Loading locale en_US from code... <===========--> 85% EXECUTING [29s] <===========--> 85% EXECUTING [1m 50s]
I have identified the problem and it is indeed a bug.
When user first installs and runs PDF4Teachers, and user's computer language is not en
fr
and it
, the PDF4Teachers will run a language selection window for the user to select the target language, and its execution path is as follows:
Main.Main ->Main.setup ->Main.languageAsk ->LanguageWindow.showLanguageWindow ->LanguagesUpdater.update -> LanguagesUpdater.complete ->LanguageWindow.LanguageWindow ->callBack(selectedLanguage)
The problem arises in LanguageWindow.LanguageWindow
function, the code for this function is as follows:
public LanguageWindow(CallBackArg<String> callBack){
super(new ListView<>(), StageWidth.NORMAL, TR.tr("language.chooseLanguageWindow.title"), TR.tr("language.chooseLanguageWindow.title"));
this.callBack = callBack;
if(Main.settings.language.getValue().isEmpty()) Main.settings.language.setValue("en_us");
}
In LanguageWindow
, the value of Main.settings.language
will be checked, and if the value is empty, it will be set to en_us
Afterwards, the callBack (selectedLanguage)
is excuted, and the callBack (selectedLanguage)
function code is as follows:
new LanguageWindow(selectedLanguage -> {
if(!selectedLanguage.isEmpty() && !selectedLanguage.equals(Main.settings.language.getValue())){
String oldDocPath = TR.getDocFile().getAbsolutePath();
Main.settings.language.setValue(selectedLanguage);
Main.settings.saveSettings();
if(!firstStartBehaviour){
Main.window.restart(true, oldDocPath);
}else{
TR.updateLocale();
Main.startMainWindowAuto();
}
}
});
If the language chosen by the user is fr
or it
, the codes in the if-condition
can be executed normally. However, if the language chosen by the user is en
, the condition selectedLanguage.equals (Main.settings.language.getValue ())
is True, causing the if-statement
cannot be executed. However, there is no corresponding code to handle this situation, resulting in PDF4Teachers exceptions.
In summary, the condition for this bug to occur is that the user's computer language is not en
fr
and it
, and selecting en_us
as the target language when running PDF4Teacher for the first time. Selecting fr
and it
as the target language will not cause the bug to appear.
The solution is to remove the code that sets Main.settings.language
in LanguageWindow.LanguageWindow
function. The following is modified codes:
public LanguageWindow(CallBackArg<String> callBack){
super(new ListView<>(), StageWidth.NORMAL, TR.tr("language.chooseLanguageWindow.title"), TR.tr("language.chooseLanguageWindow.title"));
this.callBack = callBack;
}
Problem Unable to successfully run the
PDF4Teacher
software on Windows 10Problem description I downloaded PDF4Teachers Windows 1.4.1. msi from github release address. After double clicking on the installation file, the first time I run
PDF4Teachers
, theLanguage
selection interface will appear. After selecting theEnglish
option, theLanguage
selection interface will disappear and no other interface will appear. When I double click thePDF4Teachers
again, theLanguage
selection interface will appear again. Upon checking the Task Manager, it was found that 'PDF4Teacher' is running in the background, but it does not consume any CPU, only memory.The following is a screenshot :![image](https://github.com/ClementGre/PDF4Teachers/assets/24862284/433d8533-d820-4073-a835-315932a9104b)