6

I want to change the language of Open Liberty runtime to en_US from within Eclipse IDE but I don't know how.

Tried to set it with preferences for the JVM arguments too but it didn't work.

-Duser.language=en -Duser.country=US -Duser.variant=US

This is the boot log, as you can see it is grabbing it from my local environment "pt_BR".

Ativando liberty (Open Liberty 19.0.0.3/wlp-1.0.26.cl190320190321-1636) em OpenJDK 64-Bit Server VM, versão 11.0.2+9 (pt_BR)
[AUDITORIA] CWWKE0001I: O servidor liberty foi ativado.
[AUDITORIA] CWWKZ0058I: Monitorando dropins para aplicativos.
[AUDITORIA] CWWKI0001I: O servidor de nome CORBA está agora disponível em corbaloc:iiop:localhost:2809/NameService.
[AUDITORIA] J2CA7001I: Adaptador de recursos wmqjmsra instalado em 7,108 segundos.
[WARNING ] CNTR4015W: O terminal de mensagens para o bean acionado por mensagens PedidoListener não pode ser ativado porque a especificação de ativação filemanager/PedidoListener não está disponível. O terminal de mensagens não receberá mensagens até que a especificação de ativação fique disponível.
[AUDITORIA] CWWKT0016I: Aplicativo da Web disponível (default_host): http://localhost:9080/filemanager/
[AUDITORIA] CWWKZ0001I: O aplicativo filemanager foi iniciado em 3,343 segundos.
[AUDITORIA] CWWKF0012I: O servidor instalou os recursos a seguir: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jndi-1.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, jsp-2.3, localConnector-1.0, managedBeans-1.0, mdb-3.2, servlet-4.0, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
[AUDITORIA] CWWKF0011I: O servidor liberty está pronto para executar um planeta mais inteligente.
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
  • how/where are you attempting to set the JVM arguments? If I do `bin/server run myServer -Duser.language=zh` then my logs are in Chinese as expected – Andy Guibert Apr 23 '19 at 22:03
  • I always create `jvm.options` file with the content `-Duser.language=en` in the `wlp/etc` folder, so I dont have to repeat it for all the servers. – Gas Apr 24 '19 at 08:26
  • @AndyGuibert sorry I forgot to mention, I am using Eclipse IDE with the appropriate plugins. I did not find a way to configure it from within the IDE. Can you help? – Evandro Pomatti Apr 24 '19 at 12:18
  • I can try -- where are you attempting to set the JVM args you mentioned in your original question? We can proceed from there – Andy Guibert Apr 24 '19 at 16:17
  • @AndyGuibert I didn't find any place within Liberty's plugin configuration to do so, so I just added to the JRE Default Arguments, in Preferences and it didn't work. But I managed to add to directly to Liberty's startup script and it solved it. Let me know here if you find a way to add it from Eclipse, otherwise I'll just close the question with the above help. – Evandro Pomatti Apr 24 '19 at 17:34
  • you should not directly modify the wlp/bin/server script, because that file is part of the Liberty install and should not be changed. Instead you should set JVM options using one of the two standard approaches I've outlined below – Andy Guibert Apr 24 '19 at 18:14
  • jvm.options was exactly what I was looking for tx! – Evandro Pomatti Apr 24 '19 at 18:35

1 Answers1

5

The user language can be set using system properties for the JVM that runs the Liberty server. There are two main ways of setting system properties for a Liberty JVM:

1 - Use a jvm.options file

You can create a plain file at ${server.config.dir}/jvm.options (right next to your server.xml) with 1 JVM option per line in the file. In this case, -Duser.language=en would do the trick

2 - On the server start command

Normally a Liberty server is started with the bin/server start myServer command. You can also add JVM options to the end of this command, and they will be applied to server when it starts. For example:

$ bin/server start myServer -Duser.language=en

More details can be found on the official documentation at: Customizing the Liberty environment

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61