• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Deployment issues

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a swing app in eclipse. So far it runs well in eclipse, but am having weird problems when it is jarred.

The part that works is getting background images. The are in package view.images.backgrounds.

To get them as a list so users can choose one I have:

f = new File(getClass().getResource("images/backgrounds").toURI());
//get a String[] of file names and return.

In eclipse this path is reported as:

file:/home/david/projects/client/bin/view/images/backgrounds/

When it is jarred it is:

file:/home/david/Documents/client/view/images/backgrounds/

Even though the package view.images.backgrounds is in the jar, it didn't work until I dropped then in a folder at view/images/backgrounds/. I am not sure why but that is perfect since end users could drop in any image they want to without fuss.

I did the same for a serialized file holding settings information. I need to read and write to it, but not doing the same thing as the images(put them in packages) results in not being able to save settings via jar file. So it is in package view.data and named settings.ser.

It works great inside eclipse, but when I jar it up I get this error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: URI is not hierarchical

The path reported when running in the jar file is file:/home/david/Documents/client/client.jar!/view/data/settings.ser which is definitely not what I need. For some reason this time client.jar is in the path, but it is not for the images.

Obviously, I need to read and write to that file, what do i need to do to get it to work while jarred?

The offending line is: ois = new ObjectInputStream(new FileInputStream(new File(tmp.getClass().getResource("data/settings.ser").toURI()))); which is run in a class in the view package.





 
Dave McCombs
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course right when I post I solve it, though it makes NO sense. I changed the path "view/data" to "./view/data" but I did not do that for the image directories.

If anyone has any insight into this I would appreciate it, as well as hints for deployment. Most of the people who will use this program are on Windows, so hopefully this will work with no additional fuss.

 
Could you hold this kitten for a sec? I need to adjust this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic