• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

migrate program from unix to windows, confuse about Path

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,all:
I have a java application which works well under linux. the folder structure of my application is like below:
app---lib
--lorenzo.jar
--work
--tmp
--data

I use this method to get the path of the lib folder:

it works well under my linux workstation, but when I migrate to windows xp with sp2, this code return the path of my $JAVA_HOME/bin path as "/d:/dev/java/jdk1.5.0/bin/"

I tried to change the code to :


It does not work, always return the jdk's bin path.

Is the jvm or classloader different from linux on windows? And how can I get the right path on windows?

Thanks!

ps: I invode my application by ant, and the main class of my application is extends Task class from ant.
 
Sheriff
Posts: 22662
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use the ClassLoader's resources, but the Class' resources.
 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the following code:

But it does not work.

Should anybody tell me something about the difference of the two different platform: windows and Unix for java?

Thanks.
 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some people told that the following code is better to use for crossing platform program, but it does not work.


Thanks.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will system.getProperty("user.dir") be of help?
 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thank, Maheshwari. That's not my need.
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of the JDK are you using? I think what Rob suggested should work although I'd read up on the javadoc for using getResource(), I think you actually want getResource("/lib") or just getResource("lib")
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic