0

I really need help here, i have a bundle that basically load the right locale property file in order to load the right language.

Now, these files, FlashcardsMessages_es.properties,FlashcardsMessages_de.properties are in a separated package as a fragment but for some reason it seems that my bundle is not finding the fragment.

java.util.MissingResourceException: Can't find bundle for base name de.tud.cs.se.flashcards.ui.FlashcardsMessages, locale es_MX
  at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
  at java.util.ResourceBundle.getBundleImpl(Unknown Source)
  at java.util.ResourceBundle.getBundle(Unknown Source)
  at de.tud.cs.se.flashcards.ui.Messages.getMessage(Messages.java:65)

This is the error i got.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: FlashCardOSGiED
Bundle-SymbolicName: FlashCardOSGiED
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: Activator
Export-Package: .,
 de.tud.cs.se.flashcards.model,
 de.tud.cs.se.flashcards.model.learning,
 de.tud.cs.se.flashcards.model.learning.basic,
 de.tud.cs.se.flashcards.persistence,
 de.tud.cs.se.flashcards.ui,
 de.tud.cs.util
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.imageio,
 javax.swing,
 javax.swing.border,
 javax.swing.event,
 org.osgi.framework,
 org.osgi.util.tracker

This is my bundle's manifest

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LocaleFragment
Bundle-SymbolicName: LocaleFragment;singleton:=true
Bundle-Version: 1.0.0.qualifier
Fragment-Host: FlashCardOSGiED
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: de.tud.cs.se.flashcards.ui

And this is my fragment's manifest.

If someone could give me some idea what could be wrong t would be awesome.

EDIT: I found the problem, so eclipse or java wont put any resource like properties files or images files inside the jar when the the compiler runs, so my solution was to put the properties files inside the "classes" folder and then after compiling eclipse did put the files inside the jar files correctly. I found this in some other website but some of the suggestions here inspired me into looking in to that direction so thanks a lot.

4

1 回答 1

0

尝试刷新主机包。

如果片段已附加到主机,则可能是您将资源打包到片段包中的方式,或者您如何在主机代码中设置资源的路径。

于 2012-07-06T12:14:56.577 回答