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

CXF JSONProvider marshalling causes java.lang.ClassNotFoundException: com.sun.xml.bind.marshaller.NamespacePrefixMapper
Switch Between Classes in Java?
Getting Error : Could not parse configuration: /hibernate.cfg.xml
JTextArea not updating after user input
aws s3 bucket copying files between buckets
Java ArrayList Error while Running this program [duplicate]
In Java 8, MyServicePort.java class is missing when generating java classes by using wsimport
Incorrect Frequency in tuner app
Not understanding how to make my for loop and if statement work
Prompt for information multiple times
Java date parse string (Unparseable date)
Passing Values from Different Source Code [closed]
JButton Windows Look and Feel
How to edit jasper file?
Thread update SurfaceView
ActiveMQ + MQTT + subscribe to “ActiveMQ.Advisory.Connection”

Categories

HOME
maven
variables
drivers
reserved
nullpointerexception
comparison
homebrew
cplex
alfresco
tizen-web-app
dxl
baqend
ebean
ezpublish
azure-media-services
portia
vifm
reveal.js
imacros
numeral.js
dtrace
fallback
decimal
django-simple-history
systemc
tostring
windows-7-x64
facebook-page
ehcache
kvc
claims-based-identity
wpfdatagrid
nhapi
web-api-testing
maquette
replaceall
ejabberd-module
dbclient
jspm
facebook-apps
large-file-upload
delicious-api
nat
lightswitch-2013
galsim
preg-match-all
ghost4j
atl
ios5
plsql-psp
bitbucket-pipelines
occlusion
objectlistview
user-controls
gzipstream
netcdf4
reactive-cocoa-5
menuitem
youcompleteme
aurelia-validation
nativeapplication
tactic
composite-key
flow-control
nbconvert
background-service
nested-sets
deadbolt-2
file-writing
jwplayer7
goose
itextpdf
pervasive-sql
eclipse-clp
icu4j
android-listview
dd
tablelayout
google-style-guide
project-planning
responsive-slides
dml
jquery-layout
mysql-error-1062
jboss-weld
typo3-neos
xsockets.net
jsctypes
google-cloud-save
dotnetnuke-5
excel-2003
random-seed
ember-app-kit
eventlistener
enterprisedb
anonymous-methods
bitsharp
rdoc
ocx
dotnethighcharts
gwt-ext
deobfuscation
mod-auth
coredump
invite
mongomapper
zend-translate
routedevent
webkit.net
uimenucontroller
text-coloring
port-number
spec#
data-acquisition

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