cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Translate the entire conversation x

Getting java.util.MissingResourceException on function java.util.ResourceBundle.getBundle

RoDes
7-Bedrock

Getting java.util.MissingResourceException on function java.util.ResourceBundle.getBundle

I recently solved a problem I had in J-Link that could be of interest to others.

I wanted to use a library as part of my J-Link program. The library is org.netbeans.swing.outline . My program uses somewhere deep down the class ETable, which has an initialization that uses a resourcebundle for localization.

 

Specifically it sets up a field for a sting that directly loads a resource Bundle.properties.

private String selectVisibleColumnsLabel =
java.util.ResourceBundle.getBundle("org/netbeans/swing/etable/Bundle").getString("LBL_SelectVisibleColumns");

 

At first this gave me an error,

java.util.MissingResourceException

because it could not find the resource.

 

The library itself loaded fine, as I have been repackaging my jar to include all libraries. (Not the best practice, but easier than adding many libraries to the protk.dat)

 

Using Creo 8.0.8.0 and Java 11.

ACCEPTED SOLUTION

Accepted Solutions
RoDes
7-Bedrock
(To:RoDes)

The problem and solution were in the classpath for my application.

Article CS309245 (https://www.ptc.com/en/support/article/CS000309245) lists 3 ways to set up a classpath.

    1. Creating the CLASSPATH environment variable either:
      1. Hardcoded in Windows : valid for the whole Windows session
      2. With a custom script (batch file) or appended to the parametric.bat file : valid solely for the current Creo session
  1. Setting the config option add_java_class_path : valid solely for the current Creo session
  2. In the .dat file using the keyword java_app_classpath : valid solely when the application is registered

I was using option 3 so far, with all my libraries and my program repackaged into a single jar.

I had to use option 2, to get this bundle to load, and to resolve my problem.

In my config.pro I added a line with keyword add_java_class_path and as value, the location of that library.

While using option 3, my classpath did not show the library. With option 2, my classpath does show the added library.

 

I hope this can help others.

View solution in original post

1 REPLY 1
RoDes
7-Bedrock
(To:RoDes)

The problem and solution were in the classpath for my application.

Article CS309245 (https://www.ptc.com/en/support/article/CS000309245) lists 3 ways to set up a classpath.

    1. Creating the CLASSPATH environment variable either:
      1. Hardcoded in Windows : valid for the whole Windows session
      2. With a custom script (batch file) or appended to the parametric.bat file : valid solely for the current Creo session
  1. Setting the config option add_java_class_path : valid solely for the current Creo session
  2. In the .dat file using the keyword java_app_classpath : valid solely when the application is registered

I was using option 3 so far, with all my libraries and my program repackaged into a single jar.

I had to use option 2, to get this bundle to load, and to resolve my problem.

In my config.pro I added a line with keyword add_java_class_path and as value, the location of that library.

While using option 3, my classpath did not show the library. With option 2, my classpath does show the added library.

 

I hope this can help others.

Announcements


Top Tags