java


Different path for building inside IDE and for deploying [duplicate]


I just finished my project everything is working fine but when i deployed it to .jar it was not showing images,
so i searched over the web and found a solution initially i was using this
File file = new File("src/sample/Drawables/1.jpg");
Image image = new Image(file.toURI().toString());
Imageview.setImage(image);
This was working good when i was simply building through the IDE are running the application.
But when i tried to run after deploying the application the image was not shown
so i found a solution
Image image = new Image(String.valueOf(getClass().getClassLoader().getResource("src/sample/Drawables/1.jpg")));
Imageview.setImage(image);
after doing this i the image was shown in the deployed application.
So i tried simmiler approch for prooperties file
initily the code was
File file = new File("src/sample/PropertiesMain/Alpha.properties");
if(!file.exists()){
file.createNewFile();
}
So again this code was working fine until i deployed my application to jar file
the error given was java io exception cannot find file specified .
the i foolishly applied same approch as i did for image.
File file = new
File(String.valueOf(getClass().getClassLoader().getResource("src/sample/PropertiesMain/Alpha.properties")));
if(!file.exists()){
file.createNewFile();
}
And obviously got this error
i need some help that how can i get that properties file!
please ask if you need any additional information !!
i am explaining that my question is not a duplicate as it is not asking about getting absolute path or anything my program was working good until i deployed it.
And i was looking help for because students usually don't know the absolute reasons of errors.
And not going to search something like This
By the way that question is not explaining anything close what i was asking in my question.

Related Links

java.lang.NoClassDefFoundError: com/google/inject/Module using Guice
Android Bitmap Downscaling
How to count how many JButtons have been clicked from a 10 x 10 java JButton grid
Using Spring MVC with html
one to one mapping with field acts as both PK & FK value not saving to db with cascade
How to find the selector for webscraping in Java?
Improving file save performance in android
Not able to read version or other attributes of pom using Dom4j?
Images are changing in ListView while scrolling in Android
Android Play Market install first run only class not found
using compareTo with maps in java
How to provide username password when using Restful api in java?
java - memory on virtual machine [duplicate]
Getting Access token from GooglePlus Sign in
How to set scheduled notification for selected day of every month
Alfresco - Methods to get Attachement

Categories

HOME
variables
iterator
hashmap
session
syntax
alfresco
at-command
programming-languages
leon
sharepoint-designer
twitter-bootstrap-4
c#-2.0
jxls
installshield
mouse
uber-api
upload
adobe-analytics
nstableview
collectd
google-cloud-ml
fallback
flask-wtforms
fatal-error
invantive-sql
reactive-cocoa
custom-wordpress-pages
java-3d
orleans
tar
mps
web-sql
phpfox
assistant
file-rename
delicious-api
librato
r-raster
column-family
sequential
html5-fullscreen
bower-install
simplexml
jquery-bootgrid
theano.scan
hue
splice
quadratic-programming
password-encryption
fault
multipeer-connectivity
veracode
brightcove
pillow
flow-control
mcafee
redundancy
quartz-composer
objective-c-swift-bridge
vmware-tools
slicknav
savon
underscore.js-templating
gstreamer-0.10
python-stackless
bluemix-app-scan
intel-fortran
icu4j
microbenchmark
php-ci
umbraco6
system.reflection
python-green
tablelayout
angularjs-ng-click
android-nested-fragment
cctv
preferences
oracle-warehouse-builder
gridfs
dataservice
file-locking
seed
plasma
chuck
javaspaces
newtonscript
dbproviderfactories
ticoredatasync
online-compilation
cufon
django-tagging
recent-documents
yui-datatable
actionview
dmx512
sproutcore-2
vc90
castle-monorail
meego
compiler-specific
audio-capture
ctp4
virtual-functions
temporal-database
multiple-languages
paul-graham

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App